How to use the svgdom.stripped function in svgdom

To help you get started, we’ve selected a few svgdom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github svgdotjs / svg.js / spec / spec / helper.js View on Github external
// lorem ipsum text
loremIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sodales\n imperdiet auctor. Nunc ultrices lectus at erat dictum pharetra\n elementum ante posuere. Duis turpis risus, blandit nec elementum et,\n posuere eget lacus. Aliquam et risus magna, eu aliquet nibh. Fusce\n consequat mi quis purus varius sagittis euismod urna interdum.\n Curabitur aliquet orci quis felis semper vulputate. Vestibulum ac nisi\n magna, id dictum diam. Proin sed metus vel magna blandit\n sodales. Pellentesque at neque ultricies nunc euismod rutrum ut in\n lorem. Mauris euismod tellus in tellus tempus interdum. Phasellus\n mattis sapien et leo feugiat dictum. Vestibulum at volutpat velit.'

beforeEach(function(){
  // test for touch device
  this.isTouchDevice = 'ontouchstart' in document.documentElement
  draw = SVG().addTo(drawing).size(100,100)
})

afterEach(function(){
  draw.remove()
})

// strip spaces from result
window.stripped = function(string) {
  string = string.replace(/\s+/g, '')
  if(string.slice(-1) == ';') string = string.slice(0, -1)
  return string
}

// This is needed because of IE11 which uses space as a delimiter in matrix
window.matrixStringToArray = function(source){
  return source
    .replace(/matrix\(|\)/, '')
    .split(SVG.regex.delimiter)
    .map(parseFloat)
}

// This is needed because of IE11 creating values like 2.99999 when calculating a transformed box
window.roundBox = function(box) {
  return new SVG.Box(

svgdom

Straightforward DOM implementation for SVG, HTML and XML

MIT
Latest version published 1 year ago

Package Health Score

61 / 100
Full package analysis