After I could solve the namespace problem between jQuery and Prototype, with the help of the friendly community here I have another problem to integrate the Svg Edit(or) into Magento. Now I get a new error message in firebug: btn.attr("title") is undefined
although the variable has multiple return values and I can't see why this isn't working. The error occurs on line 4137 in the svg-editor.js file. Any help would be great. Thanks in advance!
Line 4137:
var new_title = btn.attr('title').split('[')[0] + '[' + keyval + ']';
Edit:
Thats what i get back. Maybe it's the last value which generates the error?:
alert(btn.attr('title'));
// Select Tool [开发者_JAVA技巧1]
// Pencil Tool [2]
// Line Tool [3]
// Rectangle
// Square
// Ellipse
// Circle
// Path Tool [7]
// Text Tool [6]
// Image Tool [8]
// Zoom Tool [Ctrl+Up/Down]
// undefined
After changeing the code to @epascarello 's proposal i get more values back than before. It seems that there are some menu-items missing:
alert(btn.prop('title'));
// ...
// undefined
// undefined
// Edit Source [U]
// Wireframe Mode [F]
// undefined
// Delete Element [Delete/Backspace]
// Move to Top [Shift+Up]
// Move to Bottom [Shift+Down]
// Undo [Z]
// Redo [Y]
// Clone Element [C]
// Group Elements [G]
// undefined
Keep to attr, but check it's defined. Skip it if it's not:
if(opts.sel && !opts.hidekey && btn.attr('title')) {
var new_title = btn.attr('title').split('[')[0] + '[' + keyval + ']';
...
Use prop() instead of attr()
var btn = $("#myButton");
btn.prop("title");
精彩评论