Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added api page for CSSNestedDeclaration and the style peroperty and a… #36430
added api page for CSSNestedDeclaration and the style peroperty and a… #36430
Changes from 15 commits
804c09b
3b04b1a
a43034f
bbda516
572c8ee
3fd7711
b027a3f
9066590
1afe914
b12a538
addc205
84885f4
7d5cc32
90e2c97
88dcd0c
cc1cf3a
8077718
5e1e43f
1163d52
a84a141
95a8f89
1ef2f6b
214a01c
92d4dd6
32a0fce
477450e
a78cb6d
1303225
8a12440
7ca28d1
4e180c7
bf4fec0
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, this really doesn't tell me anything because I don't see what the types are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #36430 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my response #36430 (comment)
What do you think a reader can learn from this? I don't particularly might what you show, but it has to show something related to the API we are demonstrating, and really this does not.
If I had to do this I would either have a live example that shows the structure, or add pseudo code. Assuming the second, then something like.
Consider the following
This would be parsed into a structure similar to the one shown below. Note that blah blah.
[Note, that I am not sure this is correct - I just copied it from your original. Probably it isn't - ie. I don't think the last declaration is nested]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is, as this is how the order of the rules are retained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still not answered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I would do here is write code that creates this structure. I'd do it for you but your repo is locked for edits. So something like:
This example shows how to construct the following stylesheet using the CSSDOM API.
[Insert the code here]
Note that in order to preserve the parsing order, all the rules before nesting are handled as top-level
CSSRules
, while any top level rules after nesting are represented asCSSNestedDeclarations
.That's why the
color-black
is inside a nested declaration even though it is a top level declaration in the original document.Note that point at the end that you gave me in the other note - this is relevant to usage of this API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that this is correct, either.
The
CSSNestedDeclarations
API only returns that the there is an object of typeCSSNestedDeclarations
which in turn arecssRules
withstyle
shttps://codepen.io/CodeRedDigital/pen/vYozyrG?editors=0112
Although I believe I has managed to explain this better now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this nested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment
All the rules before nesting or at-properties are added at the top-level CSSRules anything after nesting or at-properties are added as nested declarations as that is how the order is preserved. Before CSSNestedDeclarations rules at the same level were hoisted up to the top with other rules whcih changed the order and effected the cascade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really useful thanks! Reading that I think it is more before and after nesting, and the at-rules is just a form of nesting right?
Anyway, if I can have this misunderstanding others can, so I have added proposals https://github.com/mdn/content/pull/36430/files#r1828495475 , https://github.com/mdn/content/pull/36430/files#r1828504825, #36430 (comment)