codigo0/node_modules/happy-dom/lib/css/rules/CSSGroupingRule.js
planetazuzu 5d7a6500fe refactor: Fase 1 - Clean Architecture, refactorización modular y eliminación de duplicidades
-  Ticket 1.1: Estructura Clean Architecture en backend
-  Ticket 1.2: Schemas Zod compartidos
-  Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares)
-  Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares)
-  Ticket 1.5: Eliminación de duplicidades (~50 líneas)

Cambios principales:
- Creada estructura Clean Architecture en backend/src/
- Schemas Zod compartidos en backend/src/shared/schemas/
- Refactorización modular de drugs y procedures
- Utilidades genéricas en src/utils/ (filter, validation)
- Eliminados scripts obsoletos y documentación antigua
- Corregidos errores: QueryClient, import test-error-handling
- Build verificado y funcionando correctamente
2026-01-25 21:09:47 +01:00

62 lines
2.6 KiB
JavaScript

import CSSRule from '../CSSRule.js';
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
import * as PropertySymbol from '../../PropertySymbol.js';
/**
* CSSGroupingRule interface.
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/CSSGroupingRule
*/
export default class CSSGroupingRule extends CSSRule {
[PropertySymbol.cssRules] = [];
/**
* Returns CSS rules.
*
* @returns CSS rules.
*/
get cssRules() {
return this[PropertySymbol.cssRules];
}
/**
* Inserts a new rule.
*
* @param rule Rule.
* @param [index] Index.
* @returns The index of the new rule.
*/
insertRule(rule, index) {
if (arguments.length === 0) {
throw new this[PropertySymbol.window].TypeError(`Failed to execute 'insertRule' on '${this.constructor.name}': 1 argument required, but only 0 present.`);
}
const rules = this[PropertySymbol.cssParser].parseFromString(rule);
if (rules.length === 0 || rules.length > 1) {
throw new this[PropertySymbol.window].DOMException(`Failed to execute 'insertRule' on '${this.constructor.name}': Failed to parse the rule '${rule}'.`, DOMExceptionNameEnum.syntaxError);
}
if (index !== undefined) {
index = Number(index);
if (isNaN(index) || index > this.cssRules.length) {
throw new this[PropertySymbol.window].DOMException(`Failed to execute 'insertRule' on '${this.constructor.name}': The index provided (${index}) is larger than the maximum index (${this.cssRules.length}).`, DOMExceptionNameEnum.indexSizeError);
}
this.cssRules.splice(index, 0, rules[0]);
return index;
}
const newIndex = this.cssRules.length;
this.cssRules.unshift(rules[0]);
return newIndex;
}
/**
* Removes a rule.
*
* @param index Index.
*/
deleteRule(index) {
if (arguments.length === 0) {
throw new this[PropertySymbol.window].TypeError(`Failed to execute 'deleteRule' on '${this.constructor.name}': 1 argument required, but only 0 present.`);
}
index = Number(index);
if (isNaN(index) || index < 0 || index >= this.cssRules.length) {
throw new this[PropertySymbol.window].DOMException(`Failed to execute 'deleteRule' on '${this.constructor.name}': the index (${index}) is greater than the length of the rule list.`, DOMExceptionNameEnum.indexSizeError);
}
this.cssRules.splice(index, 1);
}
}
//# sourceMappingURL=CSSGroupingRule.js.map