LGTM

On Sun, Jan 25, 2009 at 6:07 PM,  <[email protected]> wrote:
> Reviewers: metaweta,
>
> Description:
> I just updated the domita taming to recognize the empty string as legit.
> From the bug:
>
> window.getComputedStyle(document.body, null).width; // works
> window.getComputedStyle(document.body, '').width; // fails as "Bad
> pseudo
> class"
>
> Technically caja is right per the spec:
>
> "pseudoElt of type DOMString
> The pseudo-element or null if none."
>
>
> http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-OverrideAndComputed
>
> But Mozilla docs contradict this:
> "pseudoElt is a string specifying the pseudo-element to match. Should be
>
> an empty string for regular elements."
> https://developer.mozilla.org/En/DOM:window.getComputedStyle
>
> However, all browsers that implement computedStyle accept either form
> (and
> possibly other falsey values).
>
> Please review this at http://codereview.appspot.com/12504
>
> Affected files:
>  M     src/com/google/caja/plugin/domita.js
>
>
> Index: src/com/google/caja/plugin/domita.js
> ===================================================================
> --- src/com/google/caja/plugin/domita.js        (revision 3201)
> +++ src/com/google/caja/plugin/domita.js        (working copy)
> @@ -2980,7 +2980,15 @@
>           // http://www.w3.org/TR/CSS2/selector.html#q20
>           function (tameElement, pseudoElement) {
>             cajita.guard(tameNodeTrademark, tameElement);
> -            pseudoElement = (pseudoElement === null || pseudoElement ===
> void 0)
> +            // Coerce all nullish values to undefined, since that is the
> value
> +            // for unspecified parameters.
> +            // Per bug 973: pseudoElement should be null according to the
> +            // spec, but mozilla docs contradict this.
> +            // From
> https://developer.mozilla.org/En/DOM:window.getComputedStyle
> +            //     pseudoElt is a string specifying the pseudo-element to
> match.
> +            //     Should be an empty string for regular elements.
> +            pseudoElement = (pseudoElement === null || pseudoElement ===
> void 0
> +                             || '' === pseudoElement)
>                 ? void 0 : String(pseudoElement).toLowerCase();
>             if (pseudoElement !== void 0
>                 && !PSEUDO_ELEMENT_WHITELIST.hasOwnProperty(pseudoElement))
> {
>
>
>



-- 
Mike Stay - [email protected]
http://math.ucr.edu/~mike
http://reperiendi.wordpress.com

Reply via email to