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

Need more insight into the stack of open elements #237

Closed
domenic opened this issue Jan 27, 2018 · 2 comments · Fixed by #385
Closed

Need more insight into the stack of open elements #237

domenic opened this issue Jan 27, 2018 · 2 comments · Fixed by #385

Comments

@domenic
Copy link

domenic commented Jan 27, 2018

I've tried to come up with some alternative but it seems that to implement the style element properly, we need some notification: it requires action when

  • The element is popped off the stack of open elements of an HTML parser or XML parser.

  • The element is not on the stack of open elements of an HTML parser or XML parser, and it becomes connected or disconnected.

Do you have any ideas on how we could implement this in a parse5 adapter? It's currently causing a pretty bad regression in jsdom ever since we switched from the htmlparser2 adapter, with bad consequences for our consumers.

domenic added a commit to jsdom/jsdom that referenced this issue Jan 27, 2018
This replaces our previous hacky <script>-only close tag detection, which only worked in non-empty <script> cases, with a more general hacky version that works for all elements, including empty elements, by monkeypatching parse5. (Eventually inikulin/parse5#237 should give us a better solution, but for now we lock our parse5 version and monkeypatch it.)

In particular, this allows us to not parse stylesheets before their close tag is encountered, which fixes #2123 and fixes #2131.
domenic added a commit to jsdom/jsdom that referenced this issue Jan 28, 2018
This replaces our previous hacky <script>-only close tag detection, which only worked in non-empty <script> cases, with a more general hacky version that works for all elements, including empty elements, by monkeypatching parse5. (Eventually inikulin/parse5#237 should give us a better solution, but for now we lock our parse5 version and monkeypatch it.)

In particular, this allows us to not parse stylesheets before their close tag is encountered, which fixes #2123 and fixes #2131.
domenic added a commit to jsdom/jsdom that referenced this issue Jan 29, 2018
This replaces our previous hacky <script>-only close tag detection, which only worked in non-empty <script> cases, with a more general hacky version that works for all elements, including empty elements, by monkeypatching parse5. (Eventually inikulin/parse5#237 should give us a better solution, but for now we lock our parse5 version and monkeypatch it.)

In particular, this allows us to not parse stylesheets before their close tag is encountered, which fixes #2123 and fixes #2131.
@inikulin
Copy link
Owner

inikulin commented Jan 29, 2018

Hi @domenic,

we need some notification: it requires action when

Can you point me to the parts of the spec that describe these notifications? It will help me to come up with a proper API for that.

@domenic
Copy link
Author

domenic commented Jan 30, 2018

See the link for "the style element" in the OP, where the bullet points I quoted are found.

Based on jsdom/jsdom#2132, an API that would work for our purposes would be two adapter functions, each taking an element, which are called when the element is pushed and when it is popped, respectively.

domenic added a commit to jsdom/jsdom that referenced this issue Jan 30, 2018
This replaces our previous hacky <script>-only close tag detection, which only worked in non-empty <script> cases, with a more general hacky version that works for all elements, including empty elements, by monkeypatching parse5. (Eventually inikulin/parse5#237 should give us a better solution, but for now we lock our parse5 version and monkeypatch it.)

In particular, this allows us to not parse stylesheets before their close tag is encountered, which fixes #2123 and fixes #2131.
fb55 added a commit to parse5/parse5-fork that referenced this issue Jan 18, 2022
fb55 added a commit to parse5/parse5-fork that referenced this issue Feb 7, 2022
@fb55 fb55 closed this as completed in #385 Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants