HTMLElement.innerText returns opposite behavior for HTML elements that are descendants of XUL elements
Categories
(Core :: DOM: Core & HTML, enhancement, P3)
Tracking
()
People
(Reporter: jaws, Unassigned)
References
Details
Test case:
Apply the patch in bug 1703958
Right-click on a tab and choose to Mute the tab
Inspect the .tab-secondary-label
Execute $0.innerText
in the console
Expected:
$0.innerText returns "MUTED"
Actual:
$0.innerText returns ""
Further, select the .tab-icon-sound-playing-label
child, $0.innerText returns "PLAYING". Now select the .tab-icon-sound-muted-label
child, $0.innerText returns "".
:jaws: please provide more detailed STR. I couldn't reproduce the issue, because
12:09:40.014 document.querySelector(".tab-secondary-label")
12:09:40.032 null
from both the muted tab and some other tab.
Comment 2•3 years ago
|
||
.innerText is super weird old IE-ism. It depends on the layout state.
And accessing it causes a style flush and possibly also layout flush, so chrome code probably shouldn't use it, at least the getter.
I think the reason for the getter behavior is
https://searchfox.org/mozilla-central/rev/fa48ebee58d59fa846919c3e2c3122b08db57c9c/layout/xul/nsBoxFrame.h#118
https://searchfox.org/mozilla-central/rev/fa48ebee58d59fa846919c3e2c3122b08db57c9c/dom/base/nsRange.cpp#3084,3090
Maybe IsVisibleAndNotInReplacedElement could exclude XUL similarly to SVG?
Reporter | ||
Comment 3•3 years ago
|
||
(In reply to Mirko Brodesser (:mbrodesser) from comment #1)
:jaws: please provide more detailed STR. I couldn't reproduce the issue, because
12:09:40.014 document.querySelector(".tab-secondary-label") 12:09:40.032 null
from both the muted tab and some other tab.
- Apply the patch in bug 1703958
- Make sure you only have one tab open
- Right-click on a tab and choose to Mute the tab
- Open the Browser Console and execute the following: document.querySelector(".tab-secondary-label").innerText
".tab-secondary-label" is defined for all tabs regardless if Proton is enabled or not. Did you test with mozilla-central?
https://searchfox.org/mozilla-central/rev/6cbe34b441f7c7c29cd1e5f0e19c7000142f1423/browser/base/content/tabbrowser-tab.js#51
I just confirmed these STR on latest m-c (1c01cb995fc9).
Though it looks like Olli explained it and as such we will need to find a solution that doesn't use .innerText, so the priority of this bug is much lower. I am fine with closing this as "wontfix" if you agree.
Comment 4•3 years ago
|
||
I think we should even consider to hide innerText from chrome context.
Description
•