'use strict';

var element    = require('../valid-html-element')
  , randomUniq = require('time-uuid');

module.exports = function () {
	if (element(this).id) return this.id;
	return (this.id = this.nodeName.toLowerCase() + '-' + randomUniq());
};

'use strict';

var generateId = require('../../html-document/generate-id')
  , element    = require('../valid-html-element');

module.exports = function (name) {
	var id;
	if (element(this).id) return this.id;
	if (name != null) id = generateId(name);
	else id = this.nodeName.toLowerCase() + '-' + generateId();
	return (this.id = id);
};

Support name string in `getId` method
Support name string in `getId` method
