Skip to content

Commit

Permalink
Throw a useful error for deprecated use of Polymer.register
Browse files Browse the repository at this point in the history
Fixes #210
  • Loading branch information
dfreedm committed Jul 16, 2013
1 parent b3727b3 commit 448c4d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module.exports = function(grunt) {
"declaration/events.js",
"declaration/properties.js",
"declaration/attributes.js",
"declaration/polymer-element.js"
"declaration/polymer-element.js",
"deprecated.js"
].map(function(n) {
return "src/" + n;
});
Expand Down
3 changes: 2 additions & 1 deletion polymer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ var modules = [
"declaration/events.js",
"declaration/properties.js",
"declaration/attributes.js",
"declaration/polymer-element.js"
"declaration/polymer-element.js",
"deprecated.js"
].map(function(n) {
return "src/" + n;
}));
Expand Down
14 changes: 14 additions & 0 deletions src/deprecated.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright 2013 The Polymer Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/

// NOTE: put deprecated methods here that throw a useful error
Polymer.register = function(context) {
if (context != window) {
// context is the <element> here, with a name attribute
var name = context.getAttribute('name');
throw new Error('Polymer.register is deprecated in declaration of ' + name + '. Please see http://www.polymer-project.org/getting-started.html');
}
};

0 comments on commit 448c4d7

Please sign in to comment.