Skip to content

Commit

Permalink
Merge pull request #6 from HubSpot/ie8
Browse files Browse the repository at this point in the history
Fix a bug with IE8 compatibility
  • Loading branch information
adamschwartz committed Dec 3, 2013
2 parents 763dac8 + 5721265 commit 5e1257a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
8 changes: 7 additions & 1 deletion coffee/sortable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ trimRegExp = /^\s+|\s+$/g
touchDevice = 'ontouchstart' of document.documentElement
clickEvent = if touchDevice then 'touchstart' else 'click'

addEventListener = (el, event, handler) ->
if el.addEventListener?
el.addEventListener event, handler, false
else
el.attachEvent "on#{ event }", handler

sortable =
init: (options={}) ->
options.selector ?= SELECTOR
Expand All @@ -30,7 +36,7 @@ sortable =
setupClickableTH: (table, th, i) ->
type = sortable.getColumnType table, i

th.addEventListener clickEvent, (e) ->
addEventListener th, clickEvent, (e) ->
sorted = @getAttribute('data-sorted') is 'true'
sortedDirection = @getAttribute 'data-sorted-direction'

Expand Down
12 changes: 10 additions & 2 deletions js/sortable.js

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

2 changes: 1 addition & 1 deletion js/sortable.min.js

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

0 comments on commit 5e1257a

Please sign in to comment.