diff --git a/bower.json b/bower.json new file mode 100644 index 00000000..6b2fbfdb --- /dev/null +++ b/bower.json @@ -0,0 +1,33 @@ +{ + "name": "rangy", + "version": "1.3.0", + "homepage": "https://github.com/timdown/rangy", + "authors": [ + "Tim Down " + ], + "description": "A cross-browser JavaScript range and selection library.", + "main": [ + "lib/rangy-core.js", + "lib/rangy-classapplier.js", + "lib/rangy-highlighter.js", + "lib/rangy-selectionsaverestore.js", + "lib/rangy-serializer.js", + "lib/rangy-textrange.js" + ], + "moduleType": [ + "amd", + "globals", + "node" + ], + "keywords": [ + "range", + "selection", + "caret", + "DOM" + ], + "license": "MIT", + "ignore": [ + ".idea", + ".gitignore" + ] +} \ No newline at end of file diff --git a/lib/rangy-classapplier.js b/lib/rangy-classapplier.js index 9fe90d85..dc81c59a 100644 --- a/lib/rangy-classapplier.js +++ b/lib/rangy-classapplier.js @@ -66,7 +66,12 @@ } function addClass(el, className) { - if (typeof el.classList == "object") { + if (/\s+/.test(className)) { + var classes = className.split(/\s+/); + for (var i = 0, len = classes.length; i < len; ++i) { + addClass(el, classes[i]); + }; + } else if (typeof el.classList == "object") { el.classList.add(className); } else { var classNameSupported = (typeof el.className == "string");