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

Implement extended filtering for language matching #15746

Closed
KiChjang opened this issue Feb 26, 2017 · 6 comments
Closed

Implement extended filtering for language matching #15746

KiChjang opened this issue Feb 26, 2017 · 6 comments

Comments

@KiChjang
Copy link
Member

@KiChjang KiChjang commented Feb 26, 2017

#15464 added support for the lang pseudo-class, but it is using an equality comparison to check the language of the element with the languages specified in :lang(). We should instead use the algorithm specified here for matching languages.

Spec: https://tools.ietf.org/html/rfc4647#section-3.3.2
Files: components/script/dom/element.rs, components/script/layout_wrapper.rs
Tests: tests/wpt/web-platform-tests/dom/nodes/Element-matches.html, tests/wpt/css-tests/selectors-3_dev/, tests/wpt/web-platform-tests/html/dom/elements/global-attributes/ (use ./mach test-wpt with the appropriate file path to run the tests)

@emilio
Copy link
Member

@emilio emilio commented Feb 28, 2017

Do you think this is an E-Easy or E-less-easy issue @KiChjang?

@KiChjang
Copy link
Member Author

@KiChjang KiChjang commented Feb 28, 2017

Could be!

@KiChjang KiChjang added the E-easy label Feb 28, 2017
@highfive
Copy link

@highfive highfive commented Feb 28, 2017

Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the #servo channel in IRC.

If you intend to work on this issue, then add @highfive: assign me to your comment, and I'll assign this to you. 😄

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Feb 28, 2017

It is https://drafts.csswg.org/selectors/#the-lang-pseudo (currently at "Level 4") that specified complex BCP 47 matching.

An easy intermediate step is to implement Level 3 of the spec: https://drafts.csswg.org/selectors-3/#lang-pseudo

Whether an element is represented by a :lang() selector is based solely on the element's language value […] being equal to the identifier C, or beginning with the identifier C immediately followed by "-" (U+002D). The matching of C against the element's language value is performed case-insensitively within the ASCII range.

@sendilkumarn
Copy link
Contributor

@sendilkumarn sendilkumarn commented Mar 1, 2017

I would like to give it a shot. This will be my first rust code

@highfive: assign me

@highfive highfive added the C-assigned label Mar 1, 2017
@highfive
Copy link

@highfive highfive commented Mar 1, 2017

Hey @sendilkumarn! Thanks for your interest in working on this issue. It's now assigned to you!

@sendilkumarn sendilkumarn mentioned this issue Mar 2, 2017
3 of 3 tasks complete
bors-servo added a commit that referenced this issue Mar 6, 2017
ext. filtering for lang matching

<!-- Please describe your changes on the following line: -->
This adds the extended algorithm to check the lang. This is my very first encounter with`rust`.
Open to learn.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15746

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15797)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Mar 7, 2017
ext. filtering for lang matching

<!-- Please describe your changes on the following line: -->
This adds the extended algorithm to check the lang. This is my very first encounter with`rust`.
Open to learn.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15746

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15797)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Mar 7, 2017
ext. filtering for lang matching

<!-- Please describe your changes on the following line: -->
This adds the extended algorithm to check the lang. This is my very first encounter with`rust`.
Open to learn.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #15746

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15797)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

5 participants
You can’t perform that action at this time.