Skip to content

Commit

Permalink
[[FIX]] Add missing globals to browser environment
Browse files Browse the repository at this point in the history
DOM4 defines the constructors for these interfaces:

- Comment
- DocumentFragment
- Range
- Text

Add them to the "browser" environment.

Source: http://www.w3.org/TR/2014/WD-dom-20140710/
  • Loading branch information
takenspc authored and jugglinmike committed Jan 15, 2015
1 parent 8e680e6 commit 32f02e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ exports.browser = {
clearTimeout : false,
close : false,
closed : false,
Comment : false,
CustomEvent : false,
DOMParser : false,
defaultStatus : false,
Document : false,
document : false,
DocumentFragment : false,
Element : false,
ElementTimeControl : false,
Event : false,
Expand Down Expand Up @@ -176,6 +178,7 @@ exports.browser = {
Option : false,
parent : false,
print : false,
Range : false,
requestAnimationFrame : false,
removeEventListener : false,
resizeBy : false,
Expand Down Expand Up @@ -344,6 +347,7 @@ exports.browser = {
SVGViewElement : false,
SVGViewSpec : false,
SVGZoomAndPan : false,
Text : false,
TextDecoder : false,
TextEncoder : false,
TimeEvent : false,
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/fixtures/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ var mutationObserver = new MutationObserver(/* callback */);

// SVGElement
var svgProto = SVGElement.prototype;

// DOM4 Constructors
var comment = new Comment("");
var df = new DocumentFragment();
var range = new Range();
var text = new Text("");
4 changes: 4 additions & 0 deletions tests/unit/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -1439,6 +1439,10 @@ exports.browser = function (test) {
.addError(15, "'Node' is not defined.")
.addError(18, "'MutationObserver' is not defined.")
.addError(21, "'SVGElement' is not defined.")
.addError(24, "'Comment' is not defined.")
.addError(25, "'DocumentFragment' is not defined.")
.addError(26, "'Range' is not defined.")
.addError(27, "'Text' is not defined.")
.test(src, {es3: true, undef: true });

TestRun(test).test(src, {es3: true, browser: true, undef: true });
Expand Down

0 comments on commit 32f02e0

Please sign in to comment.