Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Support for x-tag-names #1893

Closed
pluma opened this issue Mar 5, 2014 · 4 comments
Closed

Support for x-tag-names #1893

pluma opened this issue Mar 5, 2014 · 4 comments

Comments

@pluma
Copy link

pluma commented Mar 5, 2014

I haven't looked through the entire code base, but in the tabs module I found that the checks for tab-heading look for an attribute called tab-heading or data-tab-heading or a tag also called tab-heading or data-tab-heading. The correct prefixed version of the tag name should probably be x-tab-heading (which is what web components will use), not data-tab-heading (which seems to have no basis as a tag name in the current HTML spec).

AngularJS is less strict about the distinction and simply strips x- and data- prefixes from attribute names and tag names alike. AngularUI should probably adopt this behaviour and simply accept x- prefixed attribute names and tag names in addition to the data- prefixed ones it already handles.

Maybe this logic could be factored out into a utility function.

@dmitriz
Copy link

dmitriz commented Apr 17, 2015

Any examples of real use cases to justify the suggestions?

@RobJacobs
Copy link
Contributor

Angular spec for directive attributes support:

<span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">

Looking at the angular code, $normalize calls directiveNormalize which calls camelCase:

function camelCase(name) {
  return name.
    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
      return offset ? letter.toUpperCase() : letter;
    }).
   replace(MOZ_HACK_REGEXP, 'Moz$1');
}

Tab heading is a bit of an oddball in that it is trying to support attribute and tag declaration, relevant code:

function isTabHeading(node) {
  return node.tagName &&  (
    node.hasAttribute('tab-heading') ||
    node.hasAttribute('data-tab-heading') ||
    node.tagName.toLowerCase() === 'tab-heading' ||
    node.tagName.toLowerCase() === 'data-tab-heading'
  );
}

@pluma
Copy link
Author

pluma commented Apr 17, 2015

I don't have a dog in this race any more because I have pretty much abandoned AngularJS at this point. If nobody else takes any interest, feel free to close this issue.

@rvanbaalen rvanbaalen added this to the Purgatory milestone Apr 22, 2015
@rvanbaalen
Copy link
Contributor

I would classify this as a bug since the tabheading should support x- notation according to the Angular spec as @RobJacobs stated.

@wesleycho wesleycho modified the milestones: 0.13.4 (Performance), Purgatory Aug 10, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants