• Bartosz Dziewoński's avatar
    Replace getElementsByTagName() with DOMCompat::querySelectorAll() for performance · 5ff5a03c
    Bartosz Dziewoński authored
    getElementsByTagName(), inexplicably, takes quadratic time (relative
    to the number of found elements).
    
    Use DOMCompat::querySelectorAll() instead (provided by Parsoid).
    Also replace some uses with DOMCompat::querySelector() for clarity.
    
    Add a hack to allow Phan to pass (adapted from DiscussionTools),
    because Parsoid has some weird class aliases to allow swapping DOM
    implementations.
    
    Set maxImages and maxHeadings to very high values (we can remove it
    later). Even 100,000 items should be processed in just a few seconds.
    You'll probably run into other parser issues before you reach that
    point.
    
    Bug: T317070
    Change-Id: I3741291edd28dff5e98074b1cf18dc8907681586
    5ff5a03c