Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

validate-element-name

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

validate-element-name - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

24

index.js

@@ -43,14 +43,22 @@ 'use strict';

function hasWarning(name) {
if (/^polymer-/.test(name)) {
if (/^polymer-/i.test(name)) {
return 'Custom element names should not start with `polymer-`.\nSee: http://webcomponents.github.io/articles/how-should-i-name-my-element';
}
if (/^x-/.test(name)) {
if (/^x-/i.test(name)) {
return 'Custom element names should not start with `x-`.\nSee: http://webcomponents.github.io/articles/how-should-i-name-my-element/';
}
if (/^ng-/.test(name)) {
if (/^ng-/i.test(name)) {
return 'Custom element names should not start with `ng-`.\nSee: http://docs.angularjs.org/guide/directive#creating-directives';
}
if (/^xml/i.test(name)) {
return 'Custom element names should not start with `xml`.';
}
if (name.toLowerCase() !== name) {
return 'Custom element names should be lowercase.';
}
if (/^[^a-z]/i.test(name)) {

@@ -60,6 +68,10 @@ return 'This element name is only valid in XHTML, not in HTML. First character should be in the range a-z.';

if (/-$/.test(name)) {
return 'Custom element names should not end with an hyphen.';
if (/[^a-z0-9]$/i.test(name)) {
return 'Custom element names should not end with a non-alpha character.';
}
if (/[\.]/.test(name)) {
return 'Custom element names should not contain a dot character as it would need to be escaped in a CSS selector.';
}
if (/[^\x20-\x7E]/.test(name)) {

@@ -73,3 +85,3 @@ return 'Custom element names should not contain non-ASCII characters.';

if (/[^a-z0-9]{2}/.test(name)) {
if (/[^a-z0-9]{2}/i.test(name)) {
return 'Custom element names should not contain consecutive non-alpha characters.';

@@ -76,0 +88,0 @@ }

{
"name": "validate-element-name",
"version": "0.5.0",
"version": "0.6.0",
"description": "Validate the name of a custom element",

@@ -5,0 +5,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc