Page MenuHomePhabricator

Using $element.closest( 'html' ).length to check whether an element is attached is slow
Closed, ResolvedPublic

Description

Using $element.closest( 'html' ).length to check whether an element is attached is slow. $.contains is ~10 times faster. https://jsfiddle.net/5o9sLbbs/

Event Timeline

matmarex created this task.Dec 16 2016, 7:57 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 16 2016, 7:57 PM

Change 327768 had a related patch set uploaded (by Bartosz Dziewoński):
TextInputWidget: Use Element#isElementAttached

https://gerrit.wikimedia.org/r/327768

Jdforrester-WMF closed this task as Resolved.Dec 17 2016, 2:42 AM
Jdforrester-WMF triaged this task as Normal priority.
Jdforrester-WMF moved this task from Backlog to OOjs-UI-0.18.3 on the OOUI board.
Jdforrester-WMF edited projects, added OOUI (OOjs-UI-0.18.3); removed OOUI.
Jdforrester-WMF edited projects, added Performance; removed Patch-For-Review.

Change 327768 merged by jenkins-bot:
TextInputWidget: Use Element#isElementAttached

https://gerrit.wikimedia.org/r/327768