google / google/material-design-lite

Namespace data attributes

Open
#4,943 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
32.2k
Forks
4.9k
PR merge metrics
No merged PRs in 30d

Description

## Problem data attribute names are not isolated

The Icon Toggle component, for example, currently uses `data-toggle-on` and `data-toggle-off` to store the attributes to be changed around. We should make these `data-mdl-toggle-on` and `data-mdl-toggle-off` to avoid accidental collisions with user-land code. For example, a developer could be integrating icon toggle's into an existing application where they do something like `$('[data-toggle-on]').forEach(item => {});` within their existing code which could then collide with our component and make things more difficult.

## Solution

use `mdl-` prefix on data attributes used internally.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.