class-design-pattern

(Difference between revisions)

Jump to: navigation, search
m (Reverted edits by Feecf (Talk) to last version by Phae)
Line 1: Line 1:
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
<h1> Class design pattern </h1>
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
== Purpose ==
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
Use the [[class-design-pattern]] to indicate semantic meaning about XHTML elements. See the discussion of [[semantic-class-names]] for background.
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
== How to use it ==
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* always use the most appropriately [[semantic-xhtml|semantic (X)HTML]] element for the content. if an appropriate semantic element is not available, use <code>span</code> or <code>div</code>. always avoid [[presentational-xhtml|presentational (X)HTML]].
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* add semantics to (X)HTML by using [[semantic-class-names]]. The <code>class</code> attribute is a space separated list of class names.
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* always choose names following the [[naming-principles|microformats naming principles]].
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
== Description ==
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
This is one of the most frequently occurring design patterns in microformats. Semantic meaning can be indicated on XHTML content by using the <code>class</code> attribute of an enclosing element. For example, [[hcard|hCard]] adds information indicating that certain elements represent vCard person or organization, its URL, Formatted Name, and Organization by the class design pattern:
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
<pre><nowiki>
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
<div class="vcard">
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
<a class="url fn" href="http://tantek.com/">Tantek Çelik</a>,
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
<span class="org">Technorati</span>
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
</div>
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
</nowiki></pre>
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
Note in particular:
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* the section of the XHTML document that the microformat is being applied to is defined by <code>class="vcard"</code>. This is very common among non-trivial microformats.
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* the use of both inline (&lt;a> and &lt;span>) and block (&lt;div>) level elements. This provides the microformat designer with a range of options for inserting semantic information without interfering with existing presentation
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* the use of multiple class names on a single element (such as <code>"url fn"</code>). This allows:
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
** single elements to have multiple meanings
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
** allows adding semantics to existing presentation
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
== Related ==
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* [[semantic-xhtml]]
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* [[semantic-class-names]]
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
 
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
== See Also ==
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* [[Main_Page#Design_Patterns|All microformat design patterns]]
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* John Udell [http://weblog.infoworld.com/udell/2004/02/09.html writes] about multiple class names
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
* [http://www.w3.org/TR/html401/struct/global.html#adef-class HTML 4.01 definition of the 'class' attribute], including notes about multiple class names
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+
-
MAKE GOD DO WHAT I WANT.MAKE ALLAH DO WHAT I WANT.PUT I TO HEAVEN GOD.PUT I TO HEAVEN ALLAH.
+

Revision as of 21:19, 2 April 2013

Contents

Class design pattern

Purpose

Use the class-design-pattern to indicate semantic meaning about XHTML elements. See the discussion of semantic-class-names for background.

How to use it

Description

This is one of the most frequently occurring design patterns in microformats. Semantic meaning can be indicated on XHTML content by using the class attribute of an enclosing element. For example, hCard adds information indicating that certain elements represent vCard person or organization, its URL, Formatted Name, and Organization by the class design pattern:

<div class="vcard">
 <a class="url fn" href="http://tantek.com/">Tantek Çelik</a>,
 <span class="org">Technorati</span>
</div>

Note in particular:

Related

See Also

class-design-pattern was last modified: Wednesday, December 31st, 1969

Views