From 1b938417e50823727f0aa5070678124b012e2053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Thu, 12 Feb 2015 18:43:08 +0100 Subject: [PATCH] Add doc.createElement and createDocumentFragment to the profiling --- .../custom_modules/modules/domQYLT/domQYLT.js | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js b/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js index fe19cdc..85ed0ef 100644 --- a/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js +++ b/lib/tools/phantomas/custom_modules/modules/domQYLT/domQYLT.js @@ -270,6 +270,61 @@ exports.module = function(phantomas) { phantomas.spy(Node.prototype, 'insertBefore', insertBeforeSpyBefore, function(result) { phantomas.leaveContext(); }); + + + phantomas.spy(Document.prototype, 'createElement', function(tagName) { + + phantomas.enterContext({ + type: 'createElement', + callDetails: { + context: { + domElement: '#document' + }, + arguments: [tagName] + }, + backtrace: phantomas.getBacktrace() + }); + + }, function(result, args) { + phantomas.leaveContext(); + }); + + + phantomas.spy(Document.prototype, 'createTextNode', function(text) { + + phantomas.enterContext({ + type: 'createTextNode', + callDetails: { + context: { + domElement: '#document' + }, + arguments: [text] + }, + backtrace: phantomas.getBacktrace() + }); + + }, function(result, args) { + phantomas.leaveContext(); + }); + + + phantomas.spy(Document.prototype, 'createDocumentFragment', function() { + + phantomas.enterContext({ + type: 'createDocumentFragment', + callDetails: { + context: { + domElement: '#document' + }, + arguments: [] + }, + backtrace: phantomas.getBacktrace() + }); + + }, function(result, args) { + phantomas.leaveContext(); + }); + })(window.__phantomas); }); });