You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/0.8/Writing decorator plugins.md.hbs
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ A {{{createLink 'decorators' 'decorator'}}} is a way to add behaviour to a node
6
6
7
7
For this example we'll create a tooltip decorator. For the impatient, you can see the [finished result in this JSFiddle](http://jsfiddle.net/tomByrer/9g3pB/11/).
8
8
9
-
Firstly, we need to add the `decorator` *directive* to any nodes that the decorator should apply to:
9
+
Firstly, we need to add the decorator *directive* to any nodes that the decorator should apply to. You can tell Ractive that an element should be decorated **as** one or more behavior classes:
10
10
11
11
```html
12
-
<p>This text contains <spandecorator='tooltip:This is a tooltip'>tooltips</span>.</p>
12
+
<p>This text contains <spanas-tooltip="'This is a tooltip'">tooltips</span>.</p>
13
13
```
14
14
15
15
(Directives are just instructions to Ractive - they don't actually get added to the element as attributes.)
16
16
17
-
Now, the `tooltip` decorator function will be called when the `<span>` is added to the DOM. The first argument to the function is the `<span>` itself; subsequent arguments given after the `:` in the directive will be passed to the function - in this case, there will be a second argument, which is the 'This is a tooltip' message.
17
+
Now, the `tooltip` decorator function will be called when the `<span>` is added to the DOM. The first argument to the function is the `<span>` itself; arguments given after the `=` in the directive will be passed to the function - in this case, there will be a second argument, which is the 'This is a tooltip' message.
18
18
19
19
Within that function, we can do whatever we like - the only rule is that it must return an object with a `teardown()` method that gets called if the `<span>` is removed from the DOM. An optional `update()` method can also be returned, which accepts the updated arguments provided to the decorator.
20
20
@@ -141,7 +141,7 @@ But wait - what if we don't want to use the `ractive-tooltip` class name? In fac
141
141
There are two ways we could address this. Firstly, we could add a whole load of additional arguments to the decorator directive:
142
142
143
143
```html
144
-
<spandecorator='tooltip:"This is a tooltip","p","tooltips-ftw",0,-20'>tooltips</span>
144
+
<spanas-tooltip="'This is a tooltip','p','tooltips-ftw',0,-20">tooltips</span>
Copy file name to clipboardExpand all lines: docs/edge/Writing decorator plugins.md.hbs
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ A {{{createLink 'decorators' 'decorator'}}} is a way to add behaviour to a node
6
6
7
7
For this example we'll create a tooltip decorator. For the impatient, you can see the [finished result in this JSFiddle](http://jsfiddle.net/tomByrer/9g3pB/11/).
8
8
9
-
Firstly, we need to add the `decorator` *directive* to any nodes that the decorator should apply to:
9
+
Firstly, we need to add the decorator *directive* to any nodes that the decorator should apply to. You can tell Ractive that an element should be decorated **as** one or more behavior classes:
10
10
11
11
```html
12
-
<p>This text contains <spandecorator='tooltip:This is a tooltip'>tooltips</span>.</p>
12
+
<p>This text contains <spanas-tooltip="'This is a tooltip'">tooltips</span>.</p>
13
13
```
14
14
15
15
(Directives are just instructions to Ractive - they don't actually get added to the element as attributes.)
16
16
17
-
Now, the `tooltip` decorator function will be called when the `<span>` is added to the DOM. The first argument to the function is the `<span>` itself; subsequent arguments given after the `:` in the directive will be passed to the function - in this case, there will be a second argument, which is the 'This is a tooltip' message.
17
+
Now, the `tooltip` decorator function will be called when the `<span>` is added to the DOM. The first argument to the function is the `<span>` itself; arguments given after the `=` in the directive will be passed to the function - in this case, there will be a second argument, which is the 'This is a tooltip' message.
18
18
19
19
Within that function, we can do whatever we like - the only rule is that it must return an object with a `teardown()` method that gets called if the `<span>` is removed from the DOM. An optional `update()` method can also be returned, which accepts the updated arguments provided to the decorator.
20
20
@@ -141,7 +141,7 @@ But wait - what if we don't want to use the `ractive-tooltip` class name? In fac
141
141
There are two ways we could address this. Firstly, we could add a whole load of additional arguments to the decorator directive:
142
142
143
143
```html
144
-
<spandecorator='tooltip:"This is a tooltip","p","tooltips-ftw",0,-20'>tooltips</span>
144
+
<spanas-tooltip="'This is a tooltip','p','tooltips-ftw',0,-20">tooltips</span>
0 commit comments