Skip to content
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

Make language of a node consider lang attribute on SVG elements. #9882

Merged
merged 2 commits into from
Oct 26, 2023

Conversation

dbaron
Copy link
Member

@dbaron dbaron commented Oct 25, 2023

The rules for finding the language of a node were made somewhat more formal in 11dc4c7 (PR #9796, fixing #3699). Both before and after that change they considered the lang attribute in the XML namespace, and the lang attribute in no namespace on HTML elements. However, the SVG spec at https://www.w3.org/TR/2018/CR-SVG2-20181004/struct.html#LangSpaceAttrs has very similar wording to the HTML spec prior to that edit, and also defined a lang attribute on SVG elements.

This updates the language of a node algorithm in HTML to consider SVG elements as well, since implementing it as written (without this change) breaks the lang attribute in SVG.

(See WHATWG Working Mode: Changes for more details.)


/dom.html ( diff )

The rules for finding the language of a node were made somewhat more
formal in 11dc4c7 (PR whatwg#9796,
fixing whatwg#3699).  Both before and after that change they considered the
lang attribute in the XML namespace, and the lang attribute in no
namespace on HTML elements.  However, the SVG spec at
https://www.w3.org/TR/2018/CR-SVG2-20181004/struct.html#LangSpaceAttrs
has very similar wording to the HTML spec prior to that edit, and also
defined a lang attribute on SVG elements.

This updates the language of a node algorithm in HTML to consider SVG
elements as well, since implementing it as written (without this change)
breaks the lang attribute in SVG.
@dbaron dbaron requested a review from annevk October 25, 2023 14:35
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 25, 2023
This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
@annevk
Copy link
Member

annevk commented Oct 25, 2023

What about MathML?

cc @bkardell

@dbaron
Copy link
Member Author

dbaron commented Oct 25, 2023

I did check https://www.w3.org/TR/MathML/chapter2.html#fund.globatt before posting this, and it explicitly says to use xml:lang.

(Also, Gecko's code explicitly allows the unnamespaced lang attribute for HTML, SVG, and XUL elements.)

@annevk
Copy link
Member

annevk commented Oct 25, 2023

Thanks, https://w3c.github.io/mathml-core/ doesn't seem to say anything about this either. Might be best to stick with xml:lang there then.

aarongable pushed a commit to chromium/chromium that referenced this pull request Oct 25, 2023
This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215017}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 25, 2023
This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215017}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 25, 2023
This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215017}
@domenic domenic merged commit aec6260 into whatwg:main Oct 26, 2023
2 checks passed
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 7, 2023
…nce rules., a=testonly

Automatic update from web-platform-tests
Implement updated HTML language inheritance rules.

This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215017}

--

wpt-commits: 6148c29da568184fae4184f739ecccaafd651af6
wpt-pr: 42732
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this pull request Nov 7, 2023
…nce rules., a=testonly

Automatic update from web-platform-tests
Implement updated HTML language inheritance rules.

This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhangg@chromium.org>
Commit-Queue: David Baron <dbaron@chromium.org>
Reviewed-by: Di Zhang <dizhangg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1215017}

--

wpt-commits: 6148c29da568184fae4184f739ecccaafd651af6
wpt-pr: 42732
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 8, 2023
…nce rules., a=testonly

Automatic update from web-platform-tests
Implement updated HTML language inheritance rules.

This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1215017}

--

wpt-commits: 6148c29da568184fae4184f739ecccaafd651af6
wpt-pr: 42732

UltraBlame original commit: 6425b442dc96bbae14adf5799ce58ea64fcfd493
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 8, 2023
…nce rules., a=testonly

Automatic update from web-platform-tests
Implement updated HTML language inheritance rules.

This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1215017}

--

wpt-commits: 6148c29da568184fae4184f739ecccaafd651af6
wpt-pr: 42732

UltraBlame original commit: 6425b442dc96bbae14adf5799ce58ea64fcfd493
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 8, 2023
…nce rules., a=testonly

Automatic update from web-platform-tests
Implement updated HTML language inheritance rules.

This makes two changes to match the HTML spec:
* only honor the unnamespaced lang attribute on HTML and SVG elements
* have <slot> elements in a shadow tree inherit language from the shadow
  host

Note that an update to the HTML specification regarding the SVG elements
case is proposed in whatwg/html#9882, but
https://www.w3.org/TR/SVG/struct.html#LangAttribute already defines it.

These changes match the related changes to the dir attribute, but use a
separate feature flag as a killswitch, since they are separable.

Fixed: 1490711
Bug: 576815
Change-Id: I6462181e6d4433aa1dcc9a2c42e5c12754830e52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4974775
Commit-Queue: Di Zhang <dizhanggchromium.org>
Commit-Queue: David Baron <dbaronchromium.org>
Reviewed-by: Di Zhang <dizhanggchromium.org>
Cr-Commit-Position: refs/heads/main{#1215017}

--

wpt-commits: 6148c29da568184fae4184f739ecccaafd651af6
wpt-pr: 42732

UltraBlame original commit: 6425b442dc96bbae14adf5799ce58ea64fcfd493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants