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
{{ message }}
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
The forEach method fails when trying to copy over properties on Safari.
forEach:
functionforEach(obj,iterator,context){varkey;if(obj){if(isFunction(obj)){for(keyinobj){// Need to check if hasOwnProperty exists,// as on IE8 the result of querySelectorAll is an object without a hasOwnProperty functionif(key!='prototype'&&key!='length'&&key!='name'&&(!obj.hasOwnProperty||obj.hasOwnProperty(key))){iterator.call(context,obj[key],key);}}}elseif(obj.forEach&&obj.forEach!==forEach){obj.forEach(iterator,context);}elseif(isArrayLike(obj)){for(key=0;key<obj.length;key++)iterator.call(context,obj[key],key);}else{for(keyinobj){if(obj.hasOwnProperty(key)){iterator.call(context,obj[key],key);}}}}returnobj;}
In the else statement, the line if (obj.hasOwnProperty(key)) { doesn't work against a ClientRect object in Safari so it never sets the data as expected.
so, this is actually a bug in Blink --- IDL attributes are meant to live in an interface's prototype, and they are always accessors, not data properties. So the hasOwnProperty() test should fail in Blink/Chrome as well.
In order for this to work for you, you're going to want your own extend() function which does not use hasOwnProperty(). However, what I'm being told (and the WebIDL spec is really hard to process, so I am taking them at their word), these properties should not even be enumerable, so you basically can't depend on for...in to work right in a functioning browser. (edit: Olli seems to be saying that they should be enumerable)
The forEach method fails when trying to copy over properties on Safari.
forEach:
In the else statement, the line
if (obj.hasOwnProperty(key)) {
doesn't work against a ClientRect object in Safari so it never sets the data as expected.JSfiddle (view the console):
http://jsfiddle.net/scts6mcs/5/
Chrome: it works as expected:
Safari: it fails to copy over the information.
The text was updated successfully, but these errors were encountered: