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
if (!("classList" in document.createElement("_")) || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g")))
resolves correctly in true and the script comes later to
This is a problem in old Safari Versions, because it is not working on DOM Objects. So there is no error but toggle or add will not work with the additional parameters.
I found a working solution for myself by adding
if ("document" in self) {
var setPropOnDOM = true;
// Detect if we can define properties on DOM Objects
try {
Object.defineProperty(document.createElement("_"), "classList", {
"get": function() {}
});
} catch (e) { //Old Safari versions will break at this point
setPropOnDOM = false;
}
// Full polyfill for browsers with no classList support
// Including IE < Edge missing SVGElement.classList
if (setPropOnDOM && (!("classList" in document.createElement("_")) || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g")))) {
Old Safaris will resolve in the catch block and then go on with partial support which is then working like expected. I will finish it next week and come back with a clean and fully response when my unit tests are green in all browsers (including old IE, Safari and so on).
The text was updated successfully, but these errors were encountered:
moehlone
pushed a commit
to moehlone/classList.js
that referenced
this issue
Apr 4, 2016
Hi,
I had a problem with Safari on iOS 6.1.3.
The if check
if (!("classList" in document.createElement("_")) || document.createElementNS && !("classList" in document.createElementNS("http://www.w3.org/2000/svg", "g")))
resolves correctly in true and the script comes later to
try { objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
This is a problem in old Safari Versions, because it is not working on DOM Objects. So there is no error but toggle or add will not work with the additional parameters.
I found a working solution for myself by adding
Old Safaris will resolve in the catch block and then go on with partial support which is then working like expected. I will finish it next week and come back with a clean and fully response when my unit tests are green in all browsers (including old IE, Safari and so on).
The text was updated successfully, but these errors were encountered: