Skip to content

Commit

Permalink
Fix for regression in v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sampotts committed Jun 12, 2017
1 parent 3ab517b commit 59e0645
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.0.4
- Fixed bug introduced in v1.0.3 with selector for disabled elements
- No long require the upfront check for elements on the page given we just listen to events

## v1.0.3
- Fixed error if no `<input type="range">` found
- CustomEvent polyfill no longer effects the global scope
Expand Down
2 changes: 1 addition & 1 deletion dist/rangetouch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rangetouch",
"version": "1.0.3",
"version": "1.0.4",
"description": "A super tiny library to make input type='range' sliders work better on touch devices",
"homepage": "https://rangetouch.com",
"main": "src/js/rangetouch.js",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ It will automatically bind to all `<input type="range">` elements, even newlt in
### CDN
You can even load RangeTouch from our CDN if you'd like:
```html
<script src="https://cdn.rangetouch.com/1.0.3/rangetouch.js"></script>
<script src="https://cdn.rangetouch.com/1.0.4/rangetouch.js"></script>
```

### Node Package Manager (NPM)
Expand Down
19 changes: 4 additions & 15 deletions src/js/rangetouch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ==========================================================================
// rangetouch.js v1.0.3
// rangetouch.js v1.0.4
// Making <input type="range"> work on touch devices
// https://github.com/selz/rangetouch
// License: The MIT License (MIT)
Expand Down Expand Up @@ -47,22 +47,11 @@
return;
}

// Build selector
var selector = getSelector();

// Find all inputs
var inputs = document.querySelectorAll(selector);

// Bail if nothing to setup
if (!inputs.length) {
return;
}

// Add useful CSS
if (settings.addCSS) {
var stylesheets = document.styleSheets;
var stylesheet = stylesheets.length ? stylesheets[0] : createStyleSheet();
stylesheet.insertRule(selector + ' { user-select: none; -webkit-user-select: none; touch-action: manipulation; }', 0);
stylesheet.insertRule(getSelector() + ' { user-select: none; -webkit-user-select: none; touch-action: manipulation; }', 0);
}

// Listen for events
Expand Down Expand Up @@ -129,10 +118,10 @@
// Check if element is disabled
function isDisabled(element) {
if (element instanceof HTMLElement) {
return element.classList.contains(settings.selectors.disabled);
return element.matches(settings.selectors.disabled) || element.disabled;
}

return false;
return true;
}

// Bind an event listener
Expand Down

0 comments on commit 59e0645

Please sign in to comment.