-
Notifications
You must be signed in to change notification settings - Fork 22.4k
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
Add prose and meta-docs for [LegacyNullToEmptyString] #28213
base: main
Are you sure you want to change the base?
Conversation
|
||
Add the following sentence to the end of the _Value_ section of the article: | ||
|
||
_When set to the `null` value, that `null` value is converted to the empty string (`""`), unlike the common behavior with strings (that would have converted it to the `"null"` string): `elt.innerHTML = null` is equivalent to `elt.innerHTML = ""`._ |
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 think it would be worth simplifying and shortening this:
_When set to the `null` value, that `null` value is converted to the empty string (`""`), unlike the common behavior with strings (that would have converted it to the `"null"` string): `elt.innerHTML = null` is equivalent to `elt.innerHTML = ""`._ | |
_When set to the `null` value, that `null` value is converted to the empty string (`""`), so `elt.innerHTML = null` is equivalent to `elt.innerHTML = ""`._ |
So I'm not sure it's worth describing what doesn't happen, just what does happen.
Also I think it's worth adding this meta-guidance (or at least a link to it) to our page templates, since that's the main place people go to figure out how to write reference pages.
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've added a link in the template.
files/en-us/web/api/canvasrenderingcontext2d/createpattern/index.md
Outdated
Show resolved
Hide resolved
...ting_guidelines/howto/write_an_api_reference/information_contained_in_a_webidl_file/index.md
Outdated
Show resolved
Hide resolved
All looks good to me! Agree with @wbamberg suggestions and one nit :) |
@teoli2003 , are you coming back to this, or should we close it for now? |
Hi @teoli2003 shall we close this for now? |
...ting_guidelines/howto/write_an_api_reference/information_contained_in_a_webidl_file/index.md
Outdated
Show resolved
Hide resolved
…e/information_contained_in_a_webidl_file/index.md Co-authored-by: Ruth John <Rumyra@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…e/information_contained_in_a_webidl_file/index.md
20f91aa
to
33a322b
Compare
I have fixed all open points and rebased. Let's ask for a re-review. |
@@ -25,7 +25,7 @@ setProperty(propertyName, value, priority) | |||
- : A string representing the CSS property name (hyphen case) to be modified. | |||
- `value` {{optional_inline}} | |||
- : A string containing the new property value. If not specified, treated | |||
as the empty string. | |||
as the empty string. A ["null"](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`). |
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 the empty string. A ["null"](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`). | |
as the empty string. A [`null`](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`). |
Also, shouldn't this be merged with the previous sentence? "If null or unspecified, it is treated the same as the empty string (""
)"
Parameter types may have special behaviors described using extended attributes (like `[LegacyNullToEmptyString]`). Here is the list of such attributes, and the addition you have to do in the prose: | ||
|
||
- `[LegacyNullToEmptyString]` | ||
- : Add the following sentence at the end of the parameter description: _A ["null"](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`)._ |
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.
- : Add the following sentence at the end of the parameter description: _A ["null"](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`)._ | |
- : Add the following sentence at the end of the parameter description: _A [`null`](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`)._ |
- : A string containing the qualified name, that is an optional | ||
prefix and colon plus the local root element name, of the document to be created. | ||
prefix and colon plus the local root element name, of the document to be created. A ["null"](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`). |
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.
prefix and colon plus the local root element name, of the document to be created. A ["null"](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`). | |
prefix and colon plus the local root element name, of the document to be created. A [`null`](/en-US/docs/Web/JavaScript/Reference/Operators/null) value is treated the same as the empty string (`""`). |
This pull request has merge conflicts that must be resolved before it can be merged. |
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
Description
This PR adds relevant information to existing MDN pages about properties or method parameters prefixed with the WebIDL
[LegacyNullToEmptyString]
.Motivation
This is part of openwebdocs/project#159 where we want to uniformize and add more information stored in WebIDLs files. Standardizing them makes them easier to understand and MDN Web docs articles more precise.
Additional details
What does this extended attribute mean?
This extended attribute alters how
null
values are converted to a string. The standard way is to convertnull
to the string"null"
. When this extended attribute is present, thenull
object is converted to an empty string (""
).What does this PR do?
null
value, with a tiny inline example.null
is passed.Related issues and pull requests
None.