Skip to content

Commit

Permalink
Handle query syntax errors nicely
Browse files Browse the repository at this point in the history
  • Loading branch information
patriksimek committed Mar 21, 2017
1 parent 7a1cc35 commit b34209c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"jquery",
"browser"
],
"version": "0.2.3",
"version": "0.2.4",
"main": "lib/sim.js",
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion src/sim.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,11 @@ do (window = window ? null) ->

selector = "##{dom.getAttribute 'id'} #{selector.substr 7}"

res = dom[method] selector
try
res = dom[method] selector
catch ex
console.error "simdom query '#{selector}' failed: #{ex.message}"
return if method is 'querySelectorAll' then [] else null

if tempId
dom.removeAttribute 'id'
Expand Down

0 comments on commit b34209c

Please sign in to comment.