3.6 Ensure code follows good semantic practices
Use standards-compliant HTML and web platform features, and avoid unnecessary complexity or non-standard code.
Success Criteria
- Semantic code:
Use valid and standards-compliant markup. - Optional features:
Remove optional HTML elements, attribute quotes, and default attributes if doing so does not negatively impact accessibility, readability, functionality, or performance. Include them when they improve accessibility, maintain clarity without compromising performance, or ensure consistent browser rendering. - Avoid non-standard code:
Avoid deprecated, proprietary, or non-standard technologies unless there is a clear, justified need such as legacy compatibility or accessibility. Use polyfills only when necessary and review them regularly for removal. - Custom code:
Use standard HTML elements, attributes, features, and APIs wherever they meet the requirement. Use custom elements, Web Components, or custom functionality only when built-in web platform capabilities cannot meet the need or when building reusable design system components.