diff --git a/src/base/utils.js b/src/base/utils.js
index a69909c50ba..feccb5a8594 100644
--- a/src/base/utils.js
+++ b/src/base/utils.js
@@ -1,3 +1,5 @@
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+
var Util = {
/**
* Checks to see if the element or its parents are disabled.
@@ -32,6 +34,18 @@ var Util = {
elementIsSibling: function elementIsSibling(element, otherElement) {
return element.parent().length &&
(element.parent()[0] === otherElement.parent()[0]);
- }
+ },
+
+ /**
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+ camelCase: function camelCase(name) {
+ return name.
+ replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+ return offset ? letter.toUpperCase() : letter;
+ });
+ },
};
diff --git a/src/components/buttons/buttons.js b/src/components/buttons/buttons.js
index abd1455b4c2..04975a6d621 100644
--- a/src/components/buttons/buttons.js
+++ b/src/components/buttons/buttons.js
@@ -47,42 +47,40 @@ angular.module('material.components.button', [
*/
function MaterialButtonDirective(ngHrefDirectives, $expectAria) {
var ngHrefDirective = ngHrefDirectives[0];
+
return {
restrict: 'E',
- transclude: true,
- template: '',
compile: function(element, attr) {
// Add an inner anchor if the element has a `href` or `ngHref` attribute,
// so this element can be clicked like a normal ``.
- var href = attr.ngHref || attr.href;
var innerElement;
- if (href) {
+ var attributesToCopy;
+ if (attr.ngHref || attr.href) {
innerElement = angular.element('');
- innerElement.attr('ng-href',href);
- innerElement.attr('rel', attr.rel);
- innerElement.attr('target', attr.target);
+ attributesToCopy = ['ng-href', 'href', 'rel', 'target'];
// Otherwise, just add an inner button element (for form submission etc)
} else {
innerElement = angular.element('