Skip to content

Add tests for iframe, textarea #6

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

Closed

Conversation

arobase-che
Copy link
Contributor

Hi,

I would like to add to add 2 tests to highlight an old bug. (I met it twice in two different contexts)

The TAP Result :

    operator: deepEqual
    expected: |-
      { data: { quirksMode: false }, type: 'root', children: [ { type: 'element', tagName: 'textarea', properties: {}, children: [ { type: 'text', value: 'Some text' } ] }, { type: 'element', tagName: 'img', properties: { alt: 'foo', src: 'bar.jpg' }, children: [] } ] }
    actual: |-
      { type: 'root', children: [ { type: 'element', tagName: 'textarea', properties: {}, children: [ { type: 'text', value: 'Some text' } ] }, { type: 'text', value: '<img alt="foo" src="bar.jpg">' } ], data: { quirksMode: false } }

We can see that a raw node is interpreted as text : { type: 'text', value: '<img alt="foo" src="bar.jpg">' }

This is caused by the fact that the parser of parse5 switch the state of the tokenizer to RCDATA (interpret everything as text i suppose) inside a iframe or textarea but i doesn't put it back to his normal state.

In fact, the tokenizer should manage his own state as it does with parse5 but it doesn't here. I think it's because hast-util-raw use internal function of parser5.

^^

I merge the two because they are related and to not pollute the repo and
to not upset Travis-ci about failed tests or untested portion of code.
@wooorm wooorm closed this in 57e6748 Jun 17, 2018
@wooorm wooorm changed the title hast-util-raw: Add 2 tests with iframe and textarea Add tests for iframe, textarea Aug 11, 2019
@wooorm wooorm added the 💪 phase/solved Post is done label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🕸️ area/tests This affects tests 💪 phase/solved Post is done 🦋 type/enhancement This is great to have
Development

Successfully merging this pull request may close these issues.

2 participants