Made Opera/Win/Non-EN workarounds only fire if bug is actually found

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1138 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Alexis Deveria 2010-01-01 16:11:48 +00:00
parent c3ed1b9bdf
commit 76b6fc1b5e
1 changed files with 12 additions and 5 deletions

View File

@ -4756,7 +4756,7 @@ function BatchCommand(text) {
}); });
// Fix XML for Opera/Win/Non-EN // Fix XML for Opera/Win/Non-EN
if(window.opera) { if(!support.goodDecimals) {
canvas.fixOperaXML(svgcontent, newDoc.documentElement); canvas.fixOperaXML(svgcontent, newDoc.documentElement);
} }
@ -5610,7 +5610,7 @@ function BatchCommand(text) {
this.getTransformList = function(elem) { this.getTransformList = function(elem) {
// Opera is included here because Opera/Win/Non-EN seems to change // Opera is included here because Opera/Win/Non-EN seems to change
// transformlist float vals to use a comma rather than a period. // transformlist float vals to use a comma rather than a period.
if (isWebkit || isOpera) { if (isWebkit || !support.goodDecimals) {
var t = svgTransformLists[elem.id]; var t = svgTransformLists[elem.id];
if (!t) { if (!t) {
svgTransformLists[elem.id] = new SVGEditTransformList(elem); svgTransformLists[elem.id] = new SVGEditTransformList(elem);
@ -6485,7 +6485,7 @@ function BatchCommand(text) {
obj_num++; obj_num++;
// Opera's "d" value needs to be reset for Opera/Win/non-EN // Opera's "d" value needs to be reset for Opera/Win/non-EN
if(isOpera && el.nodeName == 'path') { if(!support.goodDecimals && el.nodeName == 'path') {
var fixed_d = pathActions.convertPath(el); var fixed_d = pathActions.convertPath(el);
new_el.setAttribute('d', fixed_d); new_el.setAttribute('d', fixed_d);
} }
@ -6657,8 +6657,9 @@ function BatchCommand(text) {
// return svgdoc.getElementById(id); // return svgdoc.getElementById(id);
} }
// Test support for features // Test support for features/bugs
(function() { (function() {
// segList functions (for FF1.5 and 2.0)
var path = document.createElementNS(svgns,'path'); var path = document.createElementNS(svgns,'path');
path.setAttribute('d','M0,0 10,10'); path.setAttribute('d','M0,0 10,10');
var seglist = path.pathSegList; var seglist = path.pathSegList;
@ -6675,7 +6676,13 @@ function BatchCommand(text) {
support.pathInsertItemBefore = true; support.pathInsertItemBefore = true;
} catch(err) { } catch(err) {
support.pathInsertItemBefore = false; support.pathInsertItemBefore = false;
} }
// Correct decimals on clone attributes (Opera/win/non-en)
var rect = document.createElementNS(svgns,'rect');
rect.setAttribute('x',.1);
var crect = rect.cloneNode(false);
support.goodDecimals = (crect.getAttribute('x').indexOf(',') == -1);
}()); }());
} }
// Static class for various utility functions // Static class for various utility functions