Skip to content

Commit 1abf45e

Browse files
committed
Removed the Metadata plugin section from Advanced Plugin Concepts (this addresses the first half of jquery#409)
1 parent f0a47c0 commit 1abf45e

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

page/plugins/advanced-plugin-concepts.md

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -138,53 +138,6 @@ So how then do we define more functions without cluttering the namespace and wit
138138

139139
Our "debug" method cannot be accessed from outside of the closure and thus is private to our implementation.
140140

141-
### Support the Metadata Plugin
142-
143-
Depending on the type of plugin you're writing, adding support for the [Metadata Plugin](http://docs.jquery.com/Plugins/Metadata/metadata) can make it even more powerful. Personally, I love the Metadata Plugin because it lets you use unobtrusive markup to override plugin options (which is particularly useful when creating demos and examples). And supporting it is very simple!
144-
145-
```
146-
// Plugin definition.
147-
$.fn.hilight = function( options ) {
148-
149-
// Build main options before element iteration.
150-
var opts = $.extend( {}, $.fn.hilight.defaults, options );
151-
152-
return this.each(function() {
153-
var $this = $( this );
154-
155-
// Build element specific options.
156-
// This changed line tests to see if the Metadata Plugin is installed,
157-
// And if it is, it extends our options object with the extracted metadata.
158-
var o = $.meta ? $.extend( {}, opts, $this.data() ) : opts;
159-
160-
//...
161-
162-
});
163-
164-
};
165-
```
166-
167-
*Note:* This line is added as the last argument to *jQuery.extend* so it will override any other option settings. Now we can drive behavior from the markup if we choose:
168-
169-
```
170-
<!-- markup -->
171-
<div class="hilight { background: 'red', foreground: 'white' }">
172-
Have a nice day!
173-
</div>
174-
<div class="hilight { foreground: 'orange' }">
175-
Have a nice day!
176-
</div>
177-
<div class="hilight { background: 'green' }">
178-
Have a nice day!
179-
</div>
180-
```
181-
182-
And now we can hilight each of these `<div>`s uniquely using a single line of script:
183-
184-
```
185-
$( ".hilight" ).hilight();
186-
```
187-
188141
###Bob and Sue
189142

190143
Let's say Bob has created a wicked new gallery plugin (called "superGallery") which takes a list of images and makes them navigable. Bob's thrown in some animation to make it more interesting. He's tried to make the plugin as customizable as possible, and has ended up with something like this:

0 commit comments

Comments
 (0)