You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If node is not being rendered, then return items. For the purpose of this step, the following elements must act as described if the computed value of the 'display' property is not 'none':
select elements have an associated non-replaced inline CSS box whose child boxes include only those of optgroup and option element child nodes;
optgroup elements have an associated non-replaced block-level CSS box whose child boxes include only those of option element child nodes; and
option element have an associated non-replaced block-level CSS box whose child boxes are as normal for non-replaced block-level CSS boxes.
Given <select><div><option>foo</option></div></select>, select.innerText would be the empty string (because there is no option child node), which is different from old select parsing (where the div is dropped).
Also currently innerText per spec would drop text outside of optgroup/option in select. (e.g. <select>foo</select> per the current spec gives the empty string.)
I suppose the options are:
tweak it to include descendant optgroup/options, not just children
remove the special casing
keep the innerText spec as-is
I think (1) seems safest in terms of web compat, but I don't know if there are strong web compat constraints here.
I think (1) seems safest in terms of web compat, but I don't know if there are strong web compat constraints here.
There was a report on twitter around Chrome introduced the select parser change that broke option.innerText being blank:
I should do this we had some old code could be bad… we used innerText to get the text content of option elements within a select tag. It was working well and then it started giving us back blank text values… it’s unclear to me if we broke this or it was the result of something changing in chrome… we fixed our side by using innerHTML instead…
What is the issue with the HTML Standard?
https://html.spec.whatwg.org/#dom-innertext says
Given
<select><div><option>foo</option></div></select>
,select.innerText
would be the empty string (because there is nooption
child node), which is different from old select parsing (where thediv
is dropped).Relevant tests: https://wpt.fyi/results/html/dom/elements/the-innertext-and-outertext-properties/getter.html?label=master&label=experimental&aligned&q=innertext
Also currently
innerText
per spec would drop text outside ofoptgroup
/option
inselect
. (e.g.<select>foo</select>
per the current spec gives the empty string.)I suppose the options are:
optgroup
/option
s, not just childreninnerText
spec as-isI think (1) seems safest in terms of web compat, but I don't know if there are strong web compat constraints here.
Also see:
cc @josepharhar
The text was updated successfully, but these errors were encountered: