Return the current value of the named feature.
Returns the value of the feature named by name. The feature must have been previously added to the cache by has.add.
Parameter | Type | Description |
---|---|---|
name | String | Integer | The name (if a string) or identifier (if an integer) of the feature to test. |
See the dojo/has reference documentation for more information.
Register a new feature test for some named feature.
Parameter | Type | Description |
---|---|---|
name | String | Integer | The name (if a string) or identifier (if an integer) of the feature to test. |
test | Function | A test function to register. If a function, queued for testing until actually needed. The test function should return a boolean indicating the presence of a feature or bug. |
now | Boolean |
Optional Optional. Omit if |
force | Boolean |
Optional Optional. If the test already exists and force is truthy, then the existing test will be replaced; otherwise, add does not replace an existing test (that is, by default, the first test advice wins). |
A redundant test, testFn with immediate execution:
has.add("javascript", function(){ return true; }, true);
Again with the redundantness. You can do this in your tests, but we should not be doing this in any internal has.js tests
has.add("javascript", true);
Three things are passed to the testFunction. global
, document
, and a generic element
from which to work your test should the need arise.
has.add("bug-byid", function(g, d, el){ // g == global, typically window, yadda yadda // d == document object // el == the generic element. a `has` element. return false; // fake test, byid-when-form-has-name-matching-an-id is slightly longer });
Deletes the contents of the element passed to test functions.
Parameter | Type | Description |
---|---|---|
element | undefined |
Conditional loading of AMD modules based on a has feature test value.
Parameter | Type | Description |
---|---|---|
id | String | Gives the resolved module id to load. |
parentRequire | Function | The loader require function with respect to the module that contained the plugin resource in it's dependency list. |
loaded | Function | Callback to loader that consumes result of plugin demand. |
Resolves id into a module id based on possibly-nested tenary expression that branches on has feature test value(s).
Parameter | Type | Description |
---|---|---|
id | undefined | |
toAbsMid | Function | Resolves a relative module id into an absolute module id |