9

I was looking at this timeline for very boring, uninteresting reasons. The JS (and, consequently, responsive elements) on that page is broken.

Console:

VM3535:6 Uncaught ReferenceError: Invalid left-hand side in assignment
    at eval (<anonymous>)
    at http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2:11530
    at Function.globalEval (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2:11541)
    at HTMLScriptElement.bp (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2:3293)
    at Function.each (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2:11937)
    at init.domManip (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:4:1920)
    at init.append (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:3:31818)
    at init.html (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:4:776)
    at HTMLSpanElement.<anonymous> (https://stackoverflow.com/admin/posts/timeline/39442238:1100:20)
    at Function.each (http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2:11937)(anonymous function) @ jquery.min.js:2globalEval @ jquery.min.js:2bp @ jquery.min.js:2each @ jquery.min.js:2domManip @ jquery.min.js:4append @ jquery.min.js:3html @ jquery.min.js:4(anonymous function) @ 39442238:1100each @ jquery.min.js:2each @ jquery.min.js:2(anonymous function) @ 39442238:1098n @ jquery.min.js:2fireWith @ jquery.min.js:2ready @ jquery.min.js:2B @ jquery.min.js:2

Which maps to this line:

StackExchange.ready(function() {
    if (StackExchange.options.isMobile) return;

    $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
        var $hover = $(this).addClass('hover-bound')<br> // < This one
            $msg = $hover.siblings('.dupe-hammer-message');

        $hover.hover(
            function() {
                $hover.showInfoMessage(''<br> {
                    messageElement: $msg.clone().show()<br>
                    transient: false<br>
                    position: { my: 'bottom left'<br> at: 'top center'<br> offsetTop: -7 }<br>
                    dismissable: false
                });
            }<br>

Those <br>s are there in the actual code Chrome is showing, which doesn't look right.

  • 6
    Looking at the non-mod timeline page I see a HACK: voter lists should have line breaks which appears to be replacing <br>s into raw HTML, which may have included inline JavaScript that was replaced to produce this erroneous version. If so, the page would probably have continued to work because it would already have executed the correct JavaScript pre-replacement, and the invalid code would never have run. – Jeremy Banks Sep 12 '16 at 5:03
9

Jeremy Banks wins: that hack was overzealously replacing commas everywhere, even inside scripts. It has been replaced with, hum, a more proper hack.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .