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/

Details

Related Changes in Gerrit:

Event Timeline

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

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

Jdforrester-WMF triaged this task as Medium 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 Issue; removed Patch-For-Review.

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

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