I am attempting to complete a browser plugin that will analyze text and mark it in some fashion.
Basically, let\'s say your browsing and you see this come across th
There’s really no guarantee that <fhwdgads>
is never recognized as a tag with some special semantics or formatting. It might be improbable if you use a very messy tag name, but would you, really? People tend to use mnemonic names when they invent tags, and then there’s a real chance of clashing with tags in some current or future spec or browser.
Moreover, some old versions of IE ignore unrecognized tags completely, e.g. do not let you style them. This can be avoided using document.createElement()
once for each tag name, though.
Using span
or div
is as such safe in practice. There is no reason to think that browsers have some fancy formatting for them by default. Just as we don’t stop using h1
even though it is theoretically possible that it will make the content pink and blinking. It’s impossible to be foolproof if you expect browser vendors to be totally crazy.
Using classes is a different matter, though only in the sense that other style sheets play with the same class names as you. You might need to work in an environment where other author style sheets interfere with yours. But this just calls for caution; it does not make a span
or div
element with a class the wrong tool.
You can use the <DIV>
tag instead. Based from my "experience", the div element pretty much goes anywhere on the html hierarchy (inside <body>
and not inside input tags). You must note the default styles though.
I think that the using of custom html tags is not a bad way. Of course I can't promise that you have not any related technical problems with developing of your plugin. But Facebook did: http://developers.facebook.com/docs/reference/fbml/
I don't know why it has been removed.
You can also add your special namespace extention (like fb: for Facebook). Web 2.0 supports independence of data representation and user-defined tags: http://en.wikipedia.org/wiki/Web_2.0#Concepts
A solution would be to define a CSS-class that first resets all style properties so you can start off with a clean slate.
Another solution would be to use tags that are not used very often such as del
, ins
and blockquote