Labs/Personas/Previewing Code: Difference between revisions

Jump to navigation Jump to search
note that HTML special characters have to be escaped
(note that HTML special characters have to be escaped)
Line 1: Line 1:
== HTML  ==
== HTML  ==


The Personas JavaScript binds to whatever elements you pass it, but it expects a 'personas' attribute on those elements in the following format (copied from getpersonas.com):  
The Personas JavaScript binds to whatever elements you pass it, but it expects a <code>persona</code> attribute on those elements in the following format (copied from getpersonas.com):  


  <img class="preview persona"  
  <img class="preview persona"  
Line 21: Line 21:
  }">
  }">


You can copy the JSON blob from any persona on getpersonas.com
You can copy the JSON blob from any persona on getpersonas.com.  Note that HTML special characters have to be escaped in the JSON record when it is placed inside the <code>persona</code> attribute, although this is not shown in the example above.  For example, the quotation mark, which appears many times in the example above, needs to be escaped to the character entity <code>&amp;quot;</code>.


== JavaScript ==
== JavaScript ==
canmove, Confirmed users
2,056

edits

Navigation menu