mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
don't fail if no classList support
This commit is contained in:
@@ -14,6 +14,12 @@
|
||||
(function(scope) {
|
||||
'use strict';
|
||||
|
||||
if (!window.DOMTokenList) {
|
||||
console.warn('Missing DOMTokenList prototype, please include a ' +
|
||||
'compatible classList polyfill such as http://goo.gl/uTcepH.');
|
||||
return;
|
||||
}
|
||||
|
||||
var unsafeUnwrap = scope.unsafeUnwrap;
|
||||
var enqueueMutation = scope.enqueueMutation;
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
var list = classListTable.get(this);
|
||||
if (!list) {
|
||||
list = unsafeUnwrap(this).classList;
|
||||
if (!list) return;
|
||||
list.ownerElement_ = this;
|
||||
classListTable.set(this, list);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,13 @@
|
||||
*/
|
||||
|
||||
suite('DOMTokenList', function() {
|
||||
if (!window.DOMTokenList) {
|
||||
test('classList returns undefined if not supported', function() {
|
||||
var div = document.createElement('div');
|
||||
assert.isUndefined(div.classList);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
test('instanceof', function() {
|
||||
var div = document.createElement('div');
|
||||
|
||||
Reference in New Issue
Block a user