-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1300 from Polymer/0.8-attributes-lib
Separate attributes function from annotations
- Loading branch information
Showing
6 changed files
with
71 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<!-- | ||
@license | ||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
--> | ||
<script> | ||
|
||
Polymer.CaseMap = { | ||
|
||
_caseMap: {}, | ||
|
||
dashToCamelCase: function(dash) { | ||
var mapped = Polymer.CaseMap._caseMap[dash]; | ||
if (mapped) { | ||
return mapped; | ||
} | ||
// TODO(sjmiles): is rejection test actually helping perf? | ||
if (dash.indexOf('-') < 0) { | ||
return Polymer.CaseMap._caseMap[dash] = dash; | ||
} | ||
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, | ||
function(m) { | ||
return m[1].toUpperCase(); | ||
} | ||
); | ||
}, | ||
|
||
camelToDashCase: function(camel) { | ||
var mapped = Polymer.CaseMap._caseMap[camel]; | ||
if (mapped) { | ||
return mapped; | ||
} | ||
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, | ||
function (g) { | ||
return g[0] + '-' + g[1].toLowerCase() | ||
} | ||
); | ||
} | ||
|
||
}; | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters