Comments (7)
I tested in IE 10 and 11, this issue still comes out.
I used your latest version (https://raw.githubusercontent.com/Alhadis/DOMTokenList/master/min/token-list.js).
var firstEl = document.querySelector('.first');
firstEl.classList.add('bold', 'italic', 'red'); // only bold is added
Anything wrong?
from domtokenlist.
Hi @ganlanyuan,
I'll look into this immediately, but can you check you're not using conditional comments to load the file? Support for conditional comments was dropped in IE 10+, so something like <!--[if IE]>
isn't going to work.
EDIT: Just to confirm, I can't reproduce this in IE10. It should be working for you too. Is the polyfill being loaded before you're adding multiple classes? It needs to load first (this includes asynchronous or deferred loading; that is, with a <script>
tag's async
or defer
attributes).
from domtokenlist.
Hi, I didn't use conditional comment actually. I included it right before the close tag.
Sent from my iPhone
On Mar 9, 2016, at 8:32 PM, John Gardner [email protected] wrote:
Hi @ganlanyuan,
I'll look into this immediately, but can you check you're not using conditional comments to load the file? Support for conditional comments was dropped in IE 10, so something like <!--[if IE]> isn't going to work.
—
Reply to this email directly or view it on GitHub.
from domtokenlist.
Are you using any other polyfills?
See my message here. You might need to drop a few unneeded ones in case they're causing conflicts. The polyfill should play nicely with others, but I haven't tested that for myself. I didn't expect users would need to load the same polyfill more than once.
from domtokenlist.
Here is my markup:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>classList: add, remove, toggle</title>
<link rel="stylesheet" href="css/classlist.css">
<script type="text/javascript" src="https://raw.githubusercontent.com/Alhadis/DOMTokenList/master/src/token-list.js"></script>
</head>
<body>
<h3>Add: bold, red, underline, heading</h3>
<p id="addClasses">Placeat eveniet, ea totam neque ab error facere nam maxime dolores molestiae tempore pariatur, consectetur fuga! Non deserunt, incidunt magnam.</p>
<h3>Remove:bold, red, underline, italic, heading</h3>
<p id="removeClasses" class="red bold italic underline heading">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Debitis dolorem reiciendis eveniet suscipit? Reiciendis, molestiae unde, officia quisquam sunt corporis.</p>
<h3>Toggle: remove italic, add red</h3>
<p id="toggleClass" class="italic">Voluptatem dolor ratione sint nostrum dolore laudantium alias esse dolorum veniam quisquam, recusandae velit, omnis? Temporibus, porro. Repellat ipsa, adipisci.</p>
<script type="text/javascript">
var
ad = document.querySelector('#addClasses'),
rm = document.querySelector('#removeClasses'),
tg = document.querySelector('#toggleClass');
ad.classList.add('bold', 'red', 'underline', 'heading');
rm.classList.remove('bold', 'red', 'underline', 'italic', 'heading');
tg.classList.toggle('red', true);
tg.classList.toggle('italic', false);
</script>
</body>
</html>
and css:
body { margin: 0; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; }
ul { margin: 0; padding: 0; }
li { list-style: none; }
a { color: inherit; text-decoration: none; }
h3 {
margin: 60px 0 0;
font-size: 20px;
}
h3, p { padding: 0 calc(50% - 450px); }
p { margin: 10px 0; }
.heading { font-size: 40px; }
.bold { font-weight: bold; }
.italic { font-style: italic; }
.red { color: red; }
.underline { text-decoration: underline; }
Could you check?
Thanks
from domtokenlist.
@ganlanyuan You're attempting to load the script directly from GitHub's servers, which don't send the correct MIME type. Internet Explorer's being asked to run a text/plain
file, instead of the expected application/javascript
. IE11 shows this in the developer console:
Try loading the file through Raw Git, or load it locally instead. :-)
from domtokenlist.
Great! It works.
Thanks a lot!
from domtokenlist.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from domtokenlist.