When creating a Tumblr post, and using the HTML editor option, when I add specific HTML attributes to elements, the TinyMCE rich text editor strips nearly everything off.
1) Stripping elements can be turned off using the following tinymce init parameter cleanup:false,
2) The default definition of valid html elmements can be found here: http://www.tinymce.com/wiki.php/Configuration:valid_elements
In order to keep data-random
as an attribute of span you will need to set the valid_children init parameter as follows
valid_children: "body[p|ol|ul|hr]" +
",span[a|b|i|u|sup|sub|img|data-random|#text]" +
",a[span|b|i|u|sup|sub|img|#text]", //...