domtokenlist
Version:
Enables support for the DOMTokenList interface in IE8-9, and fixes buggy implementations in newer browsers.
40 lines (30 loc) • 3.59 kB
HTML
<html lang="en-AU">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script src="../svg-fix.js"></script>
<script src="../token-list.js"></script>
<title>Embedded SVG Testing</title>
</head>
<body>
<div id="box">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="256px" height="239px" viewBox="0 0 256 239">
<path class="topaz virtue rot" d="M1.0247753,92.0160294c3.172817-7.3840179,12.1991968-20.668251,12.1991968-20.668251s7.7794189-12.5197601,7.612751-0.6864319c-0.0542355,3.8508224-0.3632488,10.1025543,1.1367512,11.9358826c2.9495869,3.6050491,10.0391941,8.5236893,19.5838299,12.9172134c4.3237,1.9902573,12.6666679,6.1666718,15.1666679,5.6666718L129.557312,3.3477783c0,0,2.4308319-3.4173346,4.2182312-3.3466983c1.5231018,0.0601917,3.2201691,0.6255618,4.2817688,2.513365c0.6405334,1.139061,0.1666565,5.5518389,0.1666565,7.833333c0,10.5,1.3333435,103.6666641,1.3333435,103.6666641s15.858139,0.2830963,33.6666565-4.1666641c19.724823-4.9285812,42.7802734-14.9534454,44.4444427-17.0555573c0.868988-1.0976562,0.9096222-1.9442978,0.5111084-2.5950394c-0.7192841-1.1745377-3.7406616-1.2684174-5.5587616-1.3919525c-0.8453217-0.0574417-0.6490631-0.5604935,0.0799713-1.2315369c2.6899109-2.475914,12.4241333-4.2182541,21.3149109-7.850914c10.2280579-4.1790543,19.8377838-9.1641617,20.5416718-9.4583359c0.7412567-0.3097916,1.0269928-0.0654373,1.2368011,0.2268066c0.2098236,0.292244,0.3437042,0.6323929-0.4079285,1.5956268c-0.7498016,0.9608765-8.1607819,10.5505753-15.4955444,19.2609024c-7.3706665,8.7529602-14.6650391,16.6246948-15.3333282,16.75c-1.3333435,0.25-1.5-1.25-1.5-1.25s0.2149506-6.533638-0.972229-6.1944427c-2.3333282,0.6666641-12.1850739,7.5579758-28.3194427,13.4444427c-2.921936,1.06604-7.75,1.4166641-9.875,2.4166641c-3.9738464,1.8700409-8.1698608,1.8320694-12,2.9583359c-14.7398834,4.3343048-27.3250732,4.2767334-28.75,4.375c-3.625,0.25-3.5833282,5.1666718-3.5833282,5.1666718l-1.3333435,84.6666565c0,0,0.2237396,2.6201019,2.7916718,0.6666718s6.5857544-4.8760681,8.3614044-7.2027893s4.3016815-2.2797852,4.7491455-1.9526978c1.3423615,0.9812927,2.7891998,2.4845123,2.7891998,3.9471283c0,1.0287476-8.0997925,10.0449219-15.858078,17.7083588c-6.9486389,6.863678-14.4166718,11.625-14.4166718,11.625s-6.1666718,0.8333282-5.25-6.7916718c0.9166641-7.625,0.2379608-105.1209717,0.2379608-105.1209717s-0.4316254-2.7762756-6.0712967-2.8790207c-4.0651321-0.0740662-11.8072052,0.8334427-29.6666641-3.0833359c-6.9174728-1.5170822-15.3262787-3.4973831-25.6666679-7.4166641c-23.5201836-8.9147797-32.8955765-14.9281158-38.1648788-18.0469818c-1.7064781-1.0100555-5.6698818-2.3143692-9.7534523-2.0294724c-3.9460154,0.2753067-7.780745,0.7956238-8.9261684,2.1592255C1.7808444,97.1670151-1.7359061,97.3749924,1.0247753,92.0160294zM89.2656403,111.0977783c11.9103699,2.2434006,32.375,2,32.375,2s1-76.5,0.25-78.75s-6.75,7.25-6.75,7.25l-48,64C67.1406403,105.5977783,77.3552704,108.8543777,89.2656403,111.0977783z"/>
</svg>
</div>
<script>
var div = document.createElementNS("http://www.w3.org/1999/xhtml", "div");
var box = document.getElementById("box");
var boxClasses = box.classList;
boxClasses.toggle("open");
var path = document.getElementsByTagName("path")[0];
var pathClasses = path.classList;
console.log(pathClasses);
console.log(boxClasses.contains("closed"));
boxClasses.add("closed");
boxClasses.add("closed");
console.log(boxClasses.contains("closed"));
</script>
</body>
</html>