This is about the side effects of http://www.w3.org/TR/html5/browsers.html#named-access-on-the-window-object It seems the properties that this named access creates on the window object are non-configureable. This makes it 'randomly'/'DOM dependent' impossible to create properties on the window object. Apparently Safari is the only browser that has them unconfigurable and the only browser that has them defined as actually properties. There might be a good reason for this (security ?). However, it's annoying, especially for JS libraries that might be deployed. This impredictability of which properties on your window object are defined makes this a nuisance to developers and more so. I think this should be changed. I ran into this problem here: https://github.com/ajaxorg/ace/issues/1741 Additionally specific to Safari, this seems to create a problem with local declared but uninitialized variables, which might be even more problematic. This problem is detailed in the console.log example in http://dertompson.com/2013/08/07/named-access-on-the-window-object-in-safari/ This might give a scripter unintentional and obscured access to these named objects causing unpredictable results. Further background reading materials: http://tjvantoll.com/2012/07/19/dom-element-references-as-global-variables/ https://www.w3.org/Bugs/Public/show_bug.cgi?id=11960
This seems to be fixed in Safari 9 Seed 1 ?
Hmm, or not, it seems that this issue still exists and I just ran into it again. Had a header with id="addOnloadHook", then was trying to define a property on window with the key 'addOnloadHook'. This was impossible due to named access.
Created attachment 288806 [details] Reduced testcase
This problem seems resolved in at least Safari 11.1 Not sure when the fix was made.