jquery-tmpl icon indicating copy to clipboard operation
jquery-tmpl copied to clipboard

.tmplItem() on UTF-8 content fails on some WebKit based browsers

Open saje-zz opened this issue 14 years ago • 1 comments

Calling .tmplItem() on rendered content which contains UTF-8-characters (above 0x00FF) fails on some WebKit based browsers.

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  <script src="http://ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
</head>
<body>
<script>
$.tmpl('<button>1 - no unicode</button>').appendTo('body');
$.tmpl('<button>2 - u00ff: REPLACED</button>'.replace('REPLACED', '\u00ff')).appendTo('body');
$.tmpl('<button>3 - u0100: REPLACED</button>'.replace('REPLACED', '\u0100')).appendTo('body');
$.tmpl('<button>4 - euro sign: REPLACED</button>'.replace('REPLACED', '\u20ac')).appendTo('body');
$('button').click(function(e) {
  alert($(this).tmplItem().key);
});
</script>
</body>
</html>

Works as expected on FF3.6 & IE6. WebKit based browsers tested (all fail):

  • Nokia E75: AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.1.1
  • Nokia E7: AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.8.10
  • OS X 10 Safari: AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27
Button Expected WebKit
1 1 1
2 2 2
3 3 0
4 4 0

saje-zz avatar May 12 '11 13:05 saje-zz

Thanks for taking the time to submit this issue. Just wanted to let you know this plugin is no longer being actively developed or maintained by the jQuery team. See README for more info.

rdworth avatar Oct 08 '11 06:10 rdworth