/*
 * Copyright (c) 2018, 2025, 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-missing-doctype";function getName(){return RULE_NAME};function getShortDescription(){return"The HTML document type declaration should be specified"};function getDescription(){return"JET requires HTML5 standards mode. To ensure that this mode is enabled in every browser, you should specify the HTML5 document type declaration <!doctype html>"};function register(){return{"file":_handleFile}};function _handleFile(ruleCtx){var issue;var node,siblings,i;var DomUtils=ruleCtx.utils.DomUtils;var NodeType=ruleCtx.NodeTypes;node=ruleCtx.node;if(node.type===NodeType.DIRECTIVE&&_isDocType(node.data)){return}siblings=DomUtils.getSiblings(node);for(i=0;i<siblings.length;i++){node=siblings[i];if(node.type===NodeType.DIRECTIVE){if(_isDocType(node.data)){break}}if(node.type===NodeType.TAG||node.type===NodeType.SCRIPT){if(DomUtils.isNonFragmentJetPage(ruleCtx)){issue=new ruleCtx.Issue("Missing '<!doctype html>'");ruleCtx.reporter.addIssue(issue,ruleCtx);break}}}};function _isDocType(s){s=s?s.replace(/!/g,"").trim().toLowerCase():s;return s.startsWith("doctype")};module.exports={getName,getDescription,getShortDescription,register};