mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Explicitly ban some names for Templates.
Fixes the test failure on IEs because for IEs 'name' is not a magical property on functions.
This commit is contained in:
@@ -8,9 +8,15 @@
|
||||
*/
|
||||
Template = Blaze.Template;
|
||||
|
||||
var RESERVED_TEMPLATE_NAMES = "__proto__ name".split(" ");
|
||||
|
||||
// Check for duplicate template names and illegal names that won't work.
|
||||
Template.__checkName = function (name) {
|
||||
if (name in Template) {
|
||||
// Some names can't be used for Templates. These include:
|
||||
// - Properties Blaze sets on the Template object.
|
||||
// - Properties that some browsers don't let the code to set.
|
||||
// These are specified in RESERVED_TEMPLATE_NAMES.
|
||||
if (name in Template || RESERVED_TEMPLATE_NAMES.indexOf(name) !== -1) {
|
||||
if ((Template[name] instanceof Template) && name !== "body")
|
||||
throw new Error("There are multiple templates named '" + name + "'. Each template needs a unique name.");
|
||||
throw new Error("This template name is reserved: " + name);
|
||||
|
||||
Reference in New Issue
Block a user