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
1212 document.getElementById(id)
1313
1414 $.hasChild = (parent, el) ->
15+ return unless parent and el
1516 loop
1617 return true if el is parent
1718 return if el is document.body
1819 el = el.parentElement
1920
2021 $.closestLink = (el, parent = document.body) ->
22+ return unless el and parent
2123 loop
2224 return el if el.tagName is 'A'
2325 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