# File lib/html5/treebuilders/base.rb, line 121 def elementInScope(target, tableVariant=false) # Exit early when possible. return true if @open_elements[-1].name == target # AT How about while true and simply set node to [-1] and set it to # [-2] at the end... @open_elements.reverse.each do |element| if element.name == target return true elsif element.name == 'table' return false elsif not tableVariant and SCOPING_ELEMENTS.include?(element.name) return false elsif element.name == 'html' return false end end assert false # We should never reach this point end