Opened 5 years ago

Last modified 5 years ago

#13267 confirmed Bug

Implement htmlParser.element.find() method

Reported by: Piotrek Koszuliński Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

It is hard to find matching elements in htmlParser.element. Real DOM has couple of methods like find, findOne, byId, byClass, etc., but HMTL parser has nothing except forEach() which allows you to iterate over the entire sub tree and find whatever you need.

Implementing find/findOne which would work in the same way as in real DOM is reasonable, because the CSS selectors implementation would be huge. Therefore, I propose a simpler method accepting a callback or element name. It can be implemented in few lines of code using forEach().

Based on #12854.

Change History (1)

comment:1 Changed 5 years ago by Piotrek Koszuliński

Status: newconfirmed
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy