Test-case:
<!DOCTYPE html>
<span><span><span><span><span><span><span><span><span><span>
<!-- duplicate previous line a further 99 times, for 1000 spans total -->
<script>
var cur = document.querySelector("script");
var depth = -1;
while (cur) {
cur = cur.parentNode;
depth++;
}
document.body.textContent = depth;
</script>
Outputs 513 in Chrome. It looks like any further <span>s are inserted
as siblings instead of children. The <script> is processed correctly.
IE11 outputs "1003" but then the tab seems to crash.
We don't execute the script at all. This doesn't seem desirable even
if we do limit the depth. A modified test-case for us:
<!DOCTYPE html>
<script>
onload = function() {
var els = document.querySelectorAll("span");
var cur = els[els.length - 1];
var depth = -1;
while (cur) {
cur = cur.parentNode;
depth++;
}
document.body.textContent = depth;
}
</script>
<span><span><span><span><span><span><span><span><span><span>
<!-- Another 99 lines of this -->
This outputs 201.
I think upping the limit from 200 to 512, and standardizing that,
makes sense, unless there's actually something inside Gecko that would
break from that change. I also think that further elements should be
appended as siblings, like Chrome does, not otherwise mangled. I
don't see any reason why the <script> shouldn't run in the first
test-case.
(This is all somewhat off the point of your original post, I realize.)
On Mon, May 2, 2016 at 2:38 PM, Henri Sivonen <[email protected]> wrote:
> On Mon, May 2, 2016 at 2:01 PM, Aryeh Gregor <[email protected]> wrote:
>> On Mon, May 2, 2016 at 10:22 AM, Henri Sivonen <[email protected]> wrote:
>>> If the depth limit is still needed, can now be increased?
>>
>> What do other UAs do? This seems like it may as well be standardized,
>> just so the odd corner-case page breaks the same in all UAs.
>
> Whenever people complain about this, the pages render "correctly" in
> at least Blink and WebKit. I don't recall checking Edge.
>
> --
> Henri Sivonen
> [email protected]
> https://hsivonen.fi/
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform