Skip to content

Commit

Permalink
Fix broken examples on IE9.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethcachia committed Dec 31, 2013
1 parent 0bbf88b commit 0ae18df
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/build/scripts/drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
offset = {
x: e.offsetX || e.layerX,
y: e.offsetY || e.layerY,
fixed: drag.classList.contains('border--fixed')
fixed: drag.className.indexOf('border--fixed') !== -1
};

window.addEventListener(touch ? 'touchmove' : 'mousemove', updatePosition);
Expand Down
30 changes: 19 additions & 11 deletions examples/build/scripts/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,28 @@
}


function classList(node, name, mode) {
var className = node.className;

switch (mode) {
case 'add':
className += ' ' + name;
break;
case 'remove':
var pattern = new RegExp('(?:^|\\s)' + name + '(?!\\S)', 'g');
className = className.replace(pattern, '');
break;
}

node.className = className.trim();
}


function hideArrows() {
var hiddenClass = 'slider-arrow--hidden';

if (x === 0) {
arrows[0].classList.add(hiddenClass);
} else {
arrows[0].classList.remove(hiddenClass);
}

if (x === slides.length - 1) {
arrows[1].classList.add(hiddenClass);
} else {
arrows[1].classList.remove(hiddenClass);
}
classList(arrows[0], hiddenClass, x === 0 ? 'add' : 'remove');
classList(arrows[1], hiddenClass, x === slides.length - 1 ? 'add' : 'remove');
}


Expand Down
2 changes: 1 addition & 1 deletion test/test-css-backgrounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ asyncTest('Test CSS Backgrounds', function () {

element = document.createElement('div');
element.style.backgroundImage = 'url("../examples/build/images/' + image + '.jpg")';
element.classList.add('css-background-image');
element.className = 'css-background-image';

css = snippet.split(';');

Expand Down

0 comments on commit 0ae18df

Please sign in to comment.