MCPcopy Index your code
hub / github.com/methodofaction/Method-Draw / findDefs

Function findDefs

src/js/svgcanvas.js:6864–6879  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6862// Function: findDefs
6863// Return the document's <defs> element, create it first if necessary
6864var findDefs = function() {
6865 var defs = svgcontent.getElementsByTagNameNS(svgns, "defs");
6866 if (defs.length > 0) {
6867 defs = defs[0];
6868 }
6869 else {
6870 defs = svgdoc.createElementNS(svgns, "defs" );
6871 if(svgcontent.firstChild) {
6872 // first child is a comment, so call nextSibling
6873 svgcontent.insertBefore( defs, svgcontent.firstChild.nextSibling);
6874 } else {
6875 svgcontent.appendChild(defs);
6876 }
6877 }
6878 return defs;
6879};
6880
6881// Function: setGradient
6882// Apply the current gradient to selected element's fill or stroke

Callers 4

restoreRefElemsFunction · 0.85
svgcanvas.jsFile · 0.85
findDuplicateGradientFunction · 0.85
reorientGradsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected