MCPcopy
hub / github.com/tinymce/tinymce / create

Method create

modules/tinymce/src/core/main/ts/api/html/Node.ts:99–111  ·  view source on GitHub ↗

* Creates a node of a specific type. * * @static * @method create * @param {String} name Name of the node type to create for example "b" or "#text". * @param {Object} attrs Name/value collection of attributes that will be applied to elements.

(name: string, attrs?: Record<string, string>)

Source from the content-addressed store, hash-verified

97 * @param {Object} attrs Name/value collection of attributes that will be applied to elements.
98 */
99 public static create(name: string, attrs?: Record<string, string>): AstNode {
100 // Create node
101 const node = new AstNode(name, typeLookup[name] || 1);
102
103 // Add attributes if needed
104 if (attrs) {
105 Obj.each(attrs, (value, attrName) => {
106 node.attr(attrName, value);
107 });
108 }
109
110 return node;
111 }
112
113 public name: string;
114 public type: number;

Callers

nothing calls this directly

Calls 2

attrMethod · 0.95
eachMethod · 0.80

Tested by

no test coverage detected