• jl@opera.com's avatar
    Use union types for HTMLSelectElement.add()'s arguments · c254287d
    jl@opera.com authored
    According to the specification, the first argument should be
      (HTMLOptionElement or HTMLOptGroupElement)
    and the second argument should be
      (HTMLElement or long)?
    (and also be optional and default to null).
    
    This changes behavior for the first argument (previously HTMLElement)
    where a call was a silent no-op for invalid element types, and where
    HTMLHRElement was allowed against the specification and with no
    observable effects.
    
    The new behavior is to throw TypeError for all invalid arguments, which is
    compatible with Firefox and MSIE.
    
    Also apply the same change to HTMLOptionsCollection.add(), which is little
    more than a short-hand for calling add() on the owning select element.
    Also drop the custom bindings implementation for that method, which was
    essentially implementing the unionized second argument.
    
    The behavior of HTMLOptionsCollection.add() is changed to ignore all
    invalid (out of range) integer second arguments, rather than to throw for
    negative ones below than -1. This change is also per specification and
    compatible with other implementations.
    
    BUG=430337
    
    Review URL: https://codereview.chromium.org/716773002
    
    git-svn-id: svn://svn.chromium.org/blink/trunk@185199 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    c254287d
incompatible-operations-expected.txt 1.64 KB