Opened 12 years ago
Last modified 12 years ago
#9520 confirmed Bug
Shorter way for node's type check
Reported by: | Piotrek Koszuliński | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Performance | Version: | 3.0 |
Keywords: | Cc: |
Description (last modified by )
The current way is long and isn't minifiable at all:
node.type == CKEDITOR.NODE_TEXT || node.type == CKEDITOR.NODE_ELEMENT
We may introduce shorter version. E.g. method 'is' may be added to node:
node.is( '#doc' ); // or node.is( [ '#text', '#element' ] );
Tokens have to be prepended with hash, because we already have is method to check element name. Also, it was used to duck typing, what would has to be fixed.
This solution's flaw is that additional check has to be done when method is called on element. Thus, we may think of other method's name specialized in type checking. E.g. node#node ( node.node( 'text' )
).
Change History (3)
comment:1 Changed 12 years ago by
Description: | modified (diff) |
---|
comment:2 Changed 12 years ago by
Milestone: | CKEditor 4.0.1 → CKEditor 4.1 |
---|---|
Status: | new → confirmed |
comment:3 Changed 12 years ago by
Milestone: | CKEditor 4.1 |
---|
API changes moved to 4.1.