PHP Classes

File: public/js/tinymce/src/core/src/main/js/dom/DomSerializerPreProcess.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/core/src/main/js/dom/DomSerializerPreProcess.js   Download  
File: public/js/tinymce/src/core/src/main/js/dom/DomSerializerPreProcess.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,957 bytes
 

Contents

Class file image Download
/** * DomSerializerPreProcess.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.core.dom.DomSerializerPreProcess', [ 'ephox.katamari.api.Merger', 'global!document', 'tinymce.core.api.Events', 'tinymce.core.util.Tools' ], function (Merger, document, Events, Tools) { var preProcess = function (editor, node, args) { var impl, doc, oldDoc; var dom = editor.dom; node = node.cloneNode(true); // Nodes needs to be attached to something in WebKit/Opera // This fix will make DOM ranges and make Sizzle happy! impl = document.implementation; if (impl.createHTMLDocument) { // Create an empty HTML document doc = impl.createHTMLDocument(''); // Add the element or it's children if it's a body element to the new document Tools.each(node.nodeName === 'BODY' ? node.childNodes : [node], function (node) { doc.body.appendChild(doc.importNode(node, true)); }); // Grab first child or body element for serialization if (node.nodeName !== 'BODY') { node = doc.body.firstChild; } else { node = doc.body; } // set the new document in DOMUtils so createElement etc works oldDoc = dom.doc; dom.doc = doc; } Events.firePreProcess(editor, Merger.merge(args, { node: node })); if (oldDoc) { dom.doc = oldDoc; } return node; }; var shouldFireEvent = function (editor, args) { return editor && editor.hasEventListeners('PreProcess') && !args.no_events; }; var process = function (editor, node, args) { return shouldFireEvent(editor, args) ? preProcess(editor, node, args) : node; }; return { process: process }; } );