BorisMoore / jquery-tmpl

The original official jQuery Templates plugin. This project was maintained by the jQuery team as an official jQuery plugin. It is no longer in active development, and has been superseded by JsRender.
3.23k stars 1.01k forks source link

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

Open saje-zz opened 13 years ago

saje-zz commented 13 years ago

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):

Button Expected WebKit
1 1 1
2 2 2
3 3 0
4 4 0
rdworth commented 13 years ago

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.