How to use ncname - 3 common examples

To help you get started, we’ve selected a few ncname examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / batarang / hint.bundle.js View on Github external
}

	if (name.indexOf('-') === -1) {
		return 'Custom element names must contain a hyphen. Example: unicorn-cake';
	}

	if (/^\d/i.test(name)) {
		return 'Custom element names must not start with a digit.';
	}

	if (/^-/i.test(name)) {
		return 'Custom element names must not start with a hyphen.';
	}

	// http://www.w3.org/TR/custom-elements/#concepts
	if (!ncname.test(name)) {
		return 'Invalid element name.';
	}

	if (reservedNames.indexOf(name) !== -1) {
		return 'The supplied element name is reserved and can\'t be used.\nSee: http://www.w3.org/TR/custom-elements/#concepts';
	}
};
github aemoe / webpack-react-framework / node_modules / html-minifier / src / htmlparser.js View on Github external
qnameCapture = (function() {
      var ncname = require('ncname').source.slice(1, -1);
      return '((?:' + ncname + '\\:)?' + ncname + ')';
    })(),
    startTagOpen = new RegExp('^<' + qnameCapture),
github sx1989827 / DOClever / node_modules / vue-html-loader / node_modules / html-minifier / src / htmlparser.js View on Github external
qnameCapture = (function() {
      var ncname = require('ncname').source.slice(1, -1);
      return '((?:' + ncname + '\\:)?' + ncname + ')';
    })(),
    startTagOpen = new RegExp('^<' + qnameCapture),

ncname

Regular expression for matching XML NCName

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular ncname functions