History

Handle null arguments in $.hasChild and $.closestLink

Thibaut committed 12 years ago

Commit 2c56b431 parent ce31de51 file · +2 −0Browse files

Showing the changes to assets/javascripts (1 of 1 file). Show all

Unified · Split

assets/javascripts/lib/util.coffee+2−0
@@ -12,12 +12,14 @@ $.id = (id) -> · 11 unmodified lines
12 document.getElementById(id)12 document.getElementById(id)
13 13
14$.hasChild = (parent, el) ->14$.hasChild = (parent, el) ->
15 return unless parent and el
15 loop16 loop
16 return true if el is parent17 return true if el is parent
17 return if el is document.body18 return if el is document.body
18 el = el.parentElement19 el = el.parentElement
19 20
20$.closestLink = (el, parent = document.body) ->21$.closestLink = (el, parent = document.body) ->
22 return unless el and parent
21 loop23 loop
22 return el if el.tagName is 'A'24 return el if el.tagName is 'A'
23 return if el is parent25 return if el is parent

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t