Opened 11 years ago
Last modified 11 years ago
#12023 confirmed Task
Improve performance of element.find() and element.findOne()
Reported by: | Piotrek Koszuliński | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | |
Keywords: | Cc: |
Description
These methods have to set a temporary id on the element because querySelectorAll has different behaviour that anyone could expect and it applies the selector to entire DOM tree, even below the root.
Additionally, querySelectorAll is not as fast as its simpler friends - getElementsByTagName and getElementsByClassName.
It may be worth to test such addition to find and findOne:
if ( selector.match( /^\.[a-z_-]+$/i ) ) { var found = this.$.getElementsByClassName( selector.slice( 1 ) )[ 0 ]; return found ? new CKEDITOR.dom.element( found ) : null; } else if ( selector.match( /^[a-z_-]+$/i ) ) { var found = this.$.getElementsByTagName( selector )[ 0 ]; return found ? new CKEDITOR.dom.element( found ) : null; }
This needs a research, but I'm setting milestone, because we're planning to work on #10903.
Change History (1)
comment:1 Changed 11 years ago by
Milestone: | CKEditor 4.5.0 |
---|---|
Status: | new → confirmed |
I thought about two things: