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

Should innerText have a blocklist of elements it doesn't work on? #2222

Closed
domenic opened this issue Dec 28, 2016 · 10 comments
Closed

Should innerText have a blocklist of elements it doesn't work on? #2222

domenic opened this issue Dec 28, 2016 · 10 comments
Assignees
Labels
needs tests Moving the issue forward requires someone to write tests

Comments

@domenic
Copy link
Member

domenic commented Dec 28, 2016

See previous discussion in web-platform-tests/wpt#4403 (comment) with @sleevi. I wrote some tests, which are in web-platform-tests/wpt#4403 (live at http://w3c-test.org/submissions/4403/innerText/setter.html) which show that:

  • Edge and Firefox behave as per spec; they do not prohibit innerText on any elements
  • Chrome prohibits innerText on a set of elements consisting of: the void elements plus basefont, menuitem*, and image.
  • Safari TP prohibits innerText on a set of elements consisting of: the void elements minus track and keygen, plus basefont and image.

My instinct is that we should stick with the current spec and file bugs on Blink and WebKit, but I'd love to hear from implementers in Blink and WebKit what they think. @foolip @tkent-google @cdumez ?

(* = menuitem only is blocked in Chrome when the flagged menuitem implementation is turned on.)

Note that the spec for innerText is relatively new (#1678, 2016-08-17) so it's not as if this was a deliberate "spec violation" from Blink/WebKit: it's more just that when performing the reverse-engineering process for speccing innerText, we didn't think to test elements besides <div>.

@domenic
Copy link
Member Author

domenic commented Dec 28, 2016

It's also worth noting that textContent works on all these elements, which argues to me that there's no principled reason to prevent innerText from working on them.

@sleevi
Copy link

sleevi commented Dec 28, 2016

For context: The set of elements is web-platform-tests/wpt#4403 (comment)

@cdumez
Copy link

cdumez commented Dec 29, 2016

WebKit was doing this to match IE. Since Edge no longer behaves this way and since no longer throwing should be fairly safe compatibility wise, I think it would be OK to align WebKit with the specification. Of course , this is provided that Blink devs agree to do the same.

@zcorpan
Copy link
Member

zcorpan commented Dec 30, 2016

we didn't think to test elements besides <div>.

No, we knew about the blocklist, but Gecko decided to not copy it since it seemed unlikely to be necessary for Web compat. See #1679

Chromium throws for <br>.innerText = "x" etc, Gecko does not.

Also tested at web-platform-tests/wpt#3491

IE had a similar blocklist for innerHTML and appendChild, if I remember correctly, but that was later removed.

@tabatkins
Copy link
Contributor

Yeah, I don't see a good reason to have the blocklist. We can just remove it. I've filed a bug on Chrome https://bugs.chromium.org/p/chromium/issues/detail?id=679069

@domenic
Copy link
Member Author

domenic commented Jan 6, 2017

Yeah, agreed. Just hoping to get an official Blink implementer OK, then we're good to go and can merge the various web platform test PRs. Maybe the crbug triage process will get us there sooner than pinging people on GitHub :)

@dominiccooney
Copy link

I think this is fine. I'll change Blink after the upstream test changes land.

@domenic
Copy link
Member Author

domenic commented Jan 10, 2017

Great. It sounds like this is settled. What remains is to merge web-platform-tests/wpt#3491 and web-platform-tests/wpt#4403 and then file bugs on browsers. \o/

@domenic domenic added the needs tests Moving the issue forward requires someone to write tests label Jan 10, 2017
@domenic
Copy link
Member Author

domenic commented Jan 10, 2017

Filed/commented:

Thanks all! And @zcorpan, sorry for not realizing this was already on your radar. Hopefully we can all go through the rest of your web platform test PRs soon.

@domenic domenic closed this as completed Jan 10, 2017
@tabatkins
Copy link
Contributor

And we just fixed the bug (assuming it doesn't end up reverted) https://bugs.chromium.org/p/chromium/issues/detail?id=679069#c8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs tests Moving the issue forward requires someone to write tests
Development

No branches or pull requests

6 participants