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 Element.insertAdjacentHTML #11622

Closed
nox opened this issue Jun 5, 2016 · 2 comments
Closed

Implement Element.insertAdjacentHTML #11622

nox opened this issue Jun 5, 2016 · 2 comments

Comments

@nox
Copy link
Member

@nox nox commented Jun 5, 2016

See the spec.

In a first commit, extract the matching of where_ from Element::insert_adjacent and introduce a new enum AdjacentPosition. This enum should then be passed instead of where_ to Element::insert_adjacent. This requires updating its two callers InsertAdjacentElement and InsertAdjacentText.

enum AdjacentPosition {
    BeforeBegin,
    AfterEnd,
    AfterBegin,
    BeforeEnd
}

impl AdjacentPosition {
    pub fn parse(position: &str) -> Fallible<AdjacentPosition> { ... }
}

In a second commit, use AdjacentPosition and Element::insert_adjacent to implement Element::InsertAdjacentHTML correctly.

partial interface Element {
    ...
    [Throws]
    void insertAdjacentHTML(DOMString position, DOMString text);
}
impl ElementMethods for Element {
    ...
    fn InsertAdjacentHTML(DOMString position, DOMString text) -> ErrorResult { ... }
}

Files:

  • components/script/dom/element.rs
  • components/script/dom/webidls/Element.webidl
  • tests/wpt/metadata/domparsing/insert-adjacent.html.ini
  • tests/wpt/metadata/domparsing/insert_adjacent_html.html.ini
  • tests/wpt/web-platform-tests/domparsing/insert-adjacent.html
  • tests/wpt/web-platform-tests/domparsing/insert_adjacent_html.html
@nox
Copy link
Member Author

@nox nox commented Jun 5, 2016

Just noticed that Element::insert_adjacent also doesn't do a ASCII case-insensitive match, that is wrong and whoever implements this should fix that bug while at it.

@GuillaumeGomez
Copy link
Contributor

@GuillaumeGomez GuillaumeGomez commented Jun 5, 2016

I take it.

@nox nox added the C-assigned label Jun 5, 2016
bors-servo added a commit that referenced this issue Jun 8, 2016
Insert adjacent

Fixes #11622.

r? @nox

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11668)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jun 8, 2016
Insert adjacent

Fixes #11622.

r? @nox

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11668)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Jun 8, 2016
Insert adjacent

Fixes #11622.

r? @nox

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11668)
<!-- 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.

None yet
2 participants
You can’t perform that action at this time.