Skip to content

Commit 29434fc

Browse files
Merge pull request prototypejs#54 from victor-homyakov/patch-14
Remove `Element.extend` call from `_element`.
2 parents 36a9f70 + bc48c7b commit 29434fc

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/prototype/dom/event.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,7 @@
244244

245245
// Fix a Safari bug where a text node gets passed as the target of an
246246
// anchor click rather than the anchor itself.
247-
if (node.nodeType == Node.TEXT_NODE)
248-
node = node.parentNode;
249-
250-
return Element.extend(node);
247+
return node.nodeType == Node.TEXT_NODE ? node.parentNode : node;
251248
}
252249

253250
/**
@@ -274,10 +271,10 @@
274271
* });
275272
**/
276273
function findElement(event, expression) {
277-
var element = _element(event), match = Prototype.Selector.match;
274+
var element = _element(event), selector = Prototype.Selector;
278275
if (!expression) return Element.extend(element);
279276
while (element) {
280-
if (Object.isElement(element) && match(element, expression))
277+
if (Object.isElement(element) && selector.match(element, expression))
281278
return Element.extend(element);
282279
element = element.parentNode;
283280
}

0 commit comments

Comments
 (0)