Bug 108141 - FeatureObserver: Input types are counted unexpectedly in a page with Modernizr
Summary: FeatureObserver: Input types are counted unexpectedly in a page with Modernizr
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-28 18:06 PST by Kent Tamura
Modified: 2013-01-29 02:03 PST (History)
7 users (show)

See Also:


Attachments
Patch (28.26 KB, patch)
2013-01-28 21:09 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch for landing (28.46 KB, patch)
2013-01-28 23:48 PST, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2013-01-28 18:06:10 PST
http://modernizr.com/docs/#inputtypes

If the Input Types feature of Modernizr is loaded, FeatureObserver detects that all of the types are used.  It's not information which we want.
Comment 1 Kent Tamura 2013-01-28 19:24:22 PST
Modernizr's code follows.  It appends input elements to document.body, and attaches renderers.  Probably we should count "attached && visibility!=hidden"?

    function A() {
        e.inputtypes = function(a) {
            for (var d = 0, e, f, h, i = a.length; d < i; d++)
                k.setAttribute("type", f = a[d]),
                e = k.type !== "text",
                e && (k.value = l,
                      k.style.cssText = "position:absolute;visibility:hidden;",
                      /^range$/.test(f) && k.style.WebkitAppearance !== c ? (g.appendChild(k), h = b.defaultView, e = h.getComputedStyle && h.getComputedStyle(k, null).WebkitAppearance !== "textfield" && k.offsetHeight !== 0, g.removeChild(k)) : /^(search|tel)$/.test(f) || (/^(url|email)$/.test(f) ? e = k.checkValidity && k.checkValidity() === !1 : e = k.value != l)),
                o[a[d]] = !!e;
            return o
        }("search tel url email datetime date month week time datetime-local number range color".split(" "))
    }
Comment 2 Kent Tamura 2013-01-28 21:09:03 PST
Created attachment 185145 [details]
Patch
Comment 3 Kentaro Hara 2013-01-28 21:22:51 PST
Comment on attachment 185145 [details]
Patch

Makes sense to me.
Comment 4 Build Bot 2013-01-28 23:20:18 PST
Comment on attachment 185145 [details]
Patch

Attachment 185145 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/16183019
Comment 5 Kent Tamura 2013-01-28 23:48:57 PST
Created attachment 185176 [details]
Patch for landing

Include NodeRenderStyle.h
Comment 6 WebKit Review Bot 2013-01-29 02:02:56 PST
Comment on attachment 185176 [details]
Patch for landing

Clearing flags on attachment: 185176

Committed r141086: <http://trac.webkit.org/changeset/141086>
Comment 7 WebKit Review Bot 2013-01-29 02:03:01 PST
All reviewed patches have been landed.  Closing bug.