/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const RULE_NAME="oj-html-ojtag-id";const SHORT_DESCRIPT="JET custom components should not used hard-coded 'id' attributes";const LONG_DESCRIPT="Hard-coded element IDs should not be used within custom components. Element IDs "+"must be unique for each instance of the component. See context.uniqueId in the "+"custom element documentation for information on how to derive unique IDs for elements."+"<p>If a component implements hard-coded IDs for HTML elements in the CCA view, e.g.<p>"+"<oj-input id=\"foo\"><p>, "+"then this is guaranteed to cause issues as soon as more than one instance of "+"the component is used on the page (plus there is a significant risk of "+"collision with other IDs in the page as a whole).";function getName(){return RULE_NAME};function getShortDescription(){return SHORT_DESCRIPT};function getDescription(){return LONG_DESCRIPT};function register(){var issue,attrPos;return{"ojtag":function(ruleCtx,tagName){if(ruleCtx.utils.metaLib.isBindingTag(tagName)){return}if(ruleCtx.node.attribs&&ruleCtx.node.attribs.id){var id=ruleCtx.node.attribs.id;if(id.toLowerCase().indexOf("$unique")<0){if(!ruleCtx.ojTag){issue=new ruleCtx.Issue(`<${ruleCtx.tag}> uses id attribute "${id}". Use $UniqueId.`);attrPos=ruleCtx.utils.DomUtils.getAttribPosition(ruleCtx.data,ruleCtx.node,"id");issue.setPosition(attrPos.row,attrPos.col,attrPos.start,attrPos.end);ruleCtx.reporter.addIssue(issue,ruleCtx)}}}}}};module.exports={getName,getDescription,getShortDescription,register};