我正在用 jQuery 做这个:
@xmlOut = $('<rules />')
@xmlOut.attr('xsi:schemaLocation','test')
我明白了:
<rules xsi:schemalocation='test'></rules>
“L”不再是大写了...
最佳答案
有票http://bugs.jquery.com/ticket/11166
或者,您可以将属性钩子(Hook)(小写名称)添加到 jQuery 以使用所需的 setter 方法。例如:
$.attrHooks['viewbox'] = {
set: function(elem, value, name) {
elem.setAttributeNS(null, 'viewBox', value + '');
return value;
}
};
然后您可以使用 .attr() 设置属性区分大小写:
$('svg').attr('viewBox', '0 0 100 100');
关于javascript - 使用带有 jquery 的 attr() 保持大写(区分大小写),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13470898/