Skip to content

Commit

Permalink
PhantomJS 2.0 now supports MutationObserver API
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Jun 6, 2015
1 parent 21e87e4 commit b7e3b01
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 38 deletions.
3 changes: 0 additions & 3 deletions lib/metadata/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,21 +579,18 @@
},
"DOMmutationsInserts": {
"desc": "number of <body> node inserts",
"gecko": true,
"offenders": true,
"unit": "number",
"module": "domMutations"
},
"DOMmutationsRemoves": {
"desc": "number of <body> node removes",
"gecko": true,
"offenders": true,
"unit": "number",
"module": "domMutations"
},
"DOMmutationsAttributes": {
"desc": "number of DOM nodes attributes changes",
"gecko": true,
"offenders": true,
"unit": "number",
"module": "domMutations"
Expand Down
8 changes: 3 additions & 5 deletions modules/domMutations/domMutations.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/**
* Analyzes DOM changes via MutationObserver API
*
* These metrics are only available when running phantomas using Gecko engine (--engine=gecko)
*
* @see http://dev.opera.com/articles/mutation-observers-tutorial/
*/
/* global window: true, document: true, MutationObserver: true */
Expand All @@ -12,9 +10,9 @@ exports.version = '0.1';

exports.module = function(phantomas) {
// SlimerJS only metrics
phantomas.setMetric('DOMmutationsInserts'); // @desc number of <body> node inserts @gecko
phantomas.setMetric('DOMmutationsRemoves'); // @desc number of <body> node removes @gecko
phantomas.setMetric('DOMmutationsAttributes'); // @desc number of DOM nodes attributes changes @gecko
phantomas.setMetric('DOMmutationsInserts'); // @desc number of <body> node inserts
phantomas.setMetric('DOMmutationsRemoves'); // @desc number of <body> node removes
phantomas.setMetric('DOMmutationsAttributes'); // @desc number of DOM nodes attributes changes

phantomas.once('init', function() {
phantomas.evaluate(function() {
Expand Down
31 changes: 1 addition & 30 deletions test/integration-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,13 @@

# phantomas scope helper functions
- url: "/phantomas-scope.html"
label: "/phantomas-scope.html (using PhantomJS)"
options:
engine: "webkit"
metrics:
jsErrors: 0
asserts: 10
- url: "/phantomas-scope.html"
label: "/phantomas-scope.html (using SlimerJS)"
options:
engine: "gecko"
label: "/phantomas-scope.html"
metrics:
jsErrors: 0
asserts: 10

# DOM operations
- url: "/dom-operations.html"
metrics:
requests: 3
cssCount: 1
jsCount: 1
domains: 1
DOMqueries: 20
DOMqueriesById: 7
DOMqueriesByClassName: 1
DOMqueriesByTagName: 9
DOMqueriesByQuerySelectorAll: 3
DOMinserts: 2
DOMmutationsInserts: 0
DOMqueriesDuplicated: 2
DOMqueriesAvoidable: 3
DOMqueriesWithoutResults: 4
# DOM operations (in SlimerJS)
- url: "/dom-operations.html"
label: "/dom-operations.html (using SlimerJS)"
options:
engine: "gecko"
metrics:
requests: 3
cssCount: 1
Expand Down

0 comments on commit b7e3b01

Please sign in to comment.