PHP Classes

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

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/core/src/main/js/dom/Parents.js   Download  
File: public/js/tinymce/src/core/src/main/js/dom/Parents.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,161 bytes
 

Contents

Class file image Download
/** * Parents.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.Parents', [ 'ephox.katamari.api.Fun', 'ephox.sugar.api.dom.Compare', 'ephox.sugar.api.search.Traverse' ], function (Fun, Compare, Traverse) { var dropLast = function (xs) { return xs.slice(0, -1); }; var parentsUntil = function (startNode, rootElm, predicate) { if (Compare.contains(rootElm, startNode)) { return dropLast(Traverse.parents(startNode, function (elm) { return predicate(elm) || Compare.eq(elm, rootElm); })); } else { return []; } }; var parents = function (startNode, rootElm) { return parentsUntil(startNode, rootElm, Fun.constant(false)); }; var parentsAndSelf = function (startNode, rootElm) { return [startNode].concat(parents(startNode, rootElm)); }; return { parentsUntil: parentsUntil, parents: parents, parentsAndSelf: parentsAndSelf }; } );