Pages

HTML5 classList API and Dartlang CssClassSet

Sunday, October 13, 2013
JavaScript's classList API is useful. It can manipulate css classes like jQuery's addClass, removeClass, toggleClass.
http://davidwalsh.name/classlist

For instance, you can write as follows (caution, IE version >= 10 required).

element.classList.add('foo');
element.classList.remove('foo');
element.classList.toggle('foo'); 

Dartlang has similar API named CssClassSet for that manipulation. Element object has classes property, and returns CssClassSet, which also provides add, remove, toggle, etc...

element.classes.add('foo');
element.classes.remove('foo');
element.classes.toggle('foo');

Thinking css class property, Set is proper name. Plus, since it implements Set, it provides more comprehensive functions than classList in JavaScript. http://api.dartlang.org/docs/bleeding_edge/dart_html/CssClassSet.html

3 comments:

  1. Hi friends, This is Rebeka from Chennai. I am a technology freak. I have read your blog. It was really a wonderful article and I was really impressed by reading this blog. Thanks for sharing this informative blog. I did HTML5 Training in Chennai at FITA academy, Its really useful for me to make a bright future.

    ReplyDelete
    Replies
    1. Big data is a term that describes the large volume of data – both structured and unstructured – that inundates a business on a day-to-day basis. big data projects for students But it’s not the amount of data that’s important.Project Center in Chennai

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Corporate TRaining Spring Framework the authors explore the idea of using Java in Big Data platforms.

      Spring Training in Chennai

      The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. Hallo friends, i'm from Indonesia. his info very interesting , I have a simple website Cara Agar Anak Tidak Gampang Sakit | Vitamin Anak Susah Makan | Cara Agar Anak Tidak Gampang Sakit and Suplemen Penambah Berat Badan Tanpa Efek Samping do not forget to visit our website friend ,
    thanks

    ReplyDelete