Skip to content

Commit

Permalink
Document recursive nature of hash attr expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwildig committed Feb 14, 2014
1 parent 84b9efe commit 4c5812f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,16 @@ and the output will be rendered as:

<a data-author_id='123' data-category='7' href='/posts'>Posts By Author</a>

This expansion of hashes is recursive – any value of the child hash that is
itself a hash will create an attribute for each entry, with the attribute name
prefixed with all ancestor keys. For example:

.book-info{:data => {:book => {:id => 123, :genre => 'programming'}, :category => 7}}

will render as:

<div class='book-info' data-book-genre='programming' data-book-id='123' data-category='7'></div>

### Class and ID: `.` and `#`

The period and pound sign are borrowed from CSS. They are used as shortcuts to
Expand Down

0 comments on commit 4c5812f

Please sign in to comment.