The SVGPathSeg API is being removed from the spec [1] and is being removed in Chromium 47 [2]. I implemented a drop-in polyfill[3] so svg-edit users are not broken as browsers migrate away from the path seg api. This patch simply imports the upstream pathseg.js and updates all dependencies. With this change all tests pass in Chrome 46 (with the path seg api), Chrome 47 (without the path seg api), and there are no changes to tests in Safari 9.01 or Firefox 43. I also manually tested svg-edit while developing the polyfill and could not find any broken features. [1] https://lists.w3.org/Archives/Public/www-svg/2015Jun/0044.html [2] https://groups.google.com/a/chromium.org/d/msg/blink-dev/EDC3cBg9mCU/OvElJgOWCgAJ [3] https://github.com/progers/pathseg
49 lines
1.5 KiB
HTML
49 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Unit Tests for sanitize.js</title>
|
|
<link rel='stylesheet' href='qunit/qunit.css' type='text/css'/>
|
|
<script src='../editor/jquery.js'></script>
|
|
<script src='../editor/svgedit.js'></script>
|
|
<script src='../editor/pathseg.js'></script>
|
|
<script src='../editor/browser.js'></script>
|
|
<script src='../editor/svgutils.js'></script>
|
|
<script src='../editor/sanitize.js'></script>
|
|
<script src='qunit/qunit.js'></script>
|
|
<script>
|
|
$(function() {
|
|
// log function
|
|
QUnit.log = function(details) {
|
|
if (window.console && window.console.log) {
|
|
window.console.log(details.result +' :: '+ details.message);
|
|
}
|
|
};
|
|
|
|
var svg = document.createElementNS(svgedit.NS.SVG, 'svg');
|
|
|
|
test('Test sanitizeSvg() strips ws from style attr', function() {
|
|
expect(2);
|
|
|
|
var rect = document.createElementNS(svgedit.NS.SVG, 'rect');
|
|
rect.setAttribute('style', 'stroke: blue ; stroke-width : 40;');
|
|
// sanitizeSvg() requires the node to have a parent and a document.
|
|
svg.appendChild(rect);
|
|
svgedit.sanitize.sanitizeSvg(rect);
|
|
|
|
equals(rect.getAttribute('stroke'), 'blue');
|
|
equals(rect.getAttribute('stroke-width'), '40');
|
|
});
|
|
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1 id='qunit-header'>Unit Tests for sanitize.js</h1>
|
|
<h2 id='qunit-banner'></h2>
|
|
<h2 id='qunit-userAgent'></h2>
|
|
<ol id='qunit-tests'></ol>
|
|
<div id='anchor' style='visibility:hidden'></div>
|
|
</body>
|
|
</html>
|