Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "rangy",
"version": "1.3.0",
"homepage": "https://github.com/timdown/rangy",
"authors": [
"Tim Down <[email protected]>"
],
"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"
]
}
7 changes: 6 additions & 1 deletion lib/rangy-classapplier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down