Wednesday, March 26, 2014

Dojo and usage of has()

Quote from: http://livedocs.dojotoolkit.org/dojo/has Browser sniffing and feature inference are flawed techniques for detecting browser support in client side JavaScript. So lets face the truth, dojo's own code base and how many time has(something) is used
62 "ie"
14 "quirks"
14 "dojo-sync-loader"
12 "webkit"
11 "extend-dojo"
10 "opera"
 9 "touch"
 9 "host-browser"
 7 "safari"
 7 "mozilla"
 7 "dojo-combo-api"
 5 "mac"
 5 "dom-addeventlistener"
 5 "dojo-trace-api"
 5 "bug-for-in-skips-shadowed"
 4 "ios"
 4 "highcontrast"
 4 "dom"
 4 "dojo-requirejs-api"
 4 "config-deferredInstrumentation"
 4 "chrome"
 3 'activex'
 3 "khtml"
 3 "host-rhino"
 3 "host-node"
 3 "ff"
 3 "dojo-v1x-i18n-Api"
 3 "dojo-preload-i18n-Api"
 3 "dojo-loader-eval-hint-url"
 3 "dojo-loader"
 3 "dojo-inject-api"
 3 "dojo-config-api"
 3 "config-useDeferredInstrumentation"
 3 "config-dojo-loader-catches"
 3 "android"
 3 "air"
 2 name
 2 'native-xhr'
 2 'config-dojoBlankHtmlUrl'
 2 "trident"
 2 "ie-event-behavior"
 2 "dom-qsa2.1"
 2 "dojo-unit-tests"
 2 "dojo-undef-api"
 2 "dojo-publish-privates"
 2 "dojo-log-api"
 2 "dojo-debug-messages"
 2 "dojo-cdn"
 2 "dojo-amd-factory-scan"
 2 "array-extensible"
 1 term
 1 'script-readystatechange'
 1 'native-xhr2'
 1 'native-formdata'
 1 'mozilla'
 1 'host-node'
 1 'host-browser'
 1 'dom-qsa2.1'
 1 'dom-parser'
 1 'dojo-force-activex-xhr'
 1 'config-useXDomain'
 1 'config-requestProvider'
 1 "wii"
 1 "rtl-adjust-position-for-verticalScrollBar"
 1 "position-fixed-support"
 1 "native-xhr"
 1 "json-stringify"
 1 "json-parse"
 1 "jscript"
 1 "events-mousewheel"
 1 "events-keypress-typed"
 1 "event-stopimmediatepropagation"
 1 "event-orientationchange"
 1 "event-focusin"
 1 "dom-quirks"
 1 "dom-qsa3"
 1 "dom-qsa"
 1 "dom-parser"
 1 "dom-matches-selector"
 1 "dom-compliant-qsa"
 1 "dom-attributes-specified-flag"
 1 "dom-attributes-explicit"
 1 "dojo-timeout-api"
 1 "dojo-test-sniff"
 1 "dojo-sniff"
 1 "dojo-moduleUrl"
 1 "dojo-modulePaths"
 1 "dojo-has-api"
 1 "dojo-guarantee-console"
 1 "dojo-force-activex-xhr"
 1 "dojo-fast-sync-require"
 1 "dojo-enforceDefine"
 1 "dojo-dom-ready-api"
 1 "dojo-config-require"
 1 "dojo-config-addOnLoad"
 1 "dojo-built"
 1 "css-user-select"
 1 "config-tlmSiblingOfDojo"
 1 "config-stripStrict"
 1 "config-selectorEngine"
 1 "config-publishRequireResult"
 1 "config-_allow_leaks"

3 comments:

  1. grasp 'call[callee=#has].args' -r . -o --no-filename --line-number=false --color=false

    ReplyDelete
  2. only first quick shot, anyone can fix my grasp query to prove me wrong ? maybe someone requires has under some other name ? (I'm not good with grasp yet)

    ReplyDelete
  3. 1) It takes a long time to fix legacy code.
    2) There are some things you cannot feature test unfortunately (e.g. you don't write a run-time test to see if something leaks memory, or do a geometry calculation to determine if the box model is accurate).

    We have far fewer browser sniffs than we did in the past, but it takes a long time to update a code base of this size.

    That said, I think you are misunderstanding the difference between feature testing and feature inference.

    ReplyDelete