~ubuntu-branches/ubuntu/precise/maas/precise-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/tests/event/tests/manual/focusblur-opera.html

Tags: 1.2+bzr1373+dfsg-0ubuntu1~12.04.4
* SECURITY UPDATE: failure to authenticate downloaded content (LP: #1039513)
  - debian/patches/CVE-2013-1058.patch: Authenticate downloaded files with
    GnuPG and MD5SUM files. Thanks to Julian Edwards.
  - CVE-2013-1058
* SECURITY UPDATE: configuration options may be loaded from current working
  directory (LP: #1158425)
  - debian/patches/CVE-2013-1057-1-2.patch: Do not load configuration
    options from the current working directory. Thanks to Julian Edwards.
  - CVE-2013-1057

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
 
   "http://www.w3.org/TR/html4/strict.dtd">
3
 
 
4
 
<html>
5
 
<head>
6
 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
7
 
        <title>Focus and Blur Event Test for Opera</title>
8
 
        <script type="text/javascript" src="../../../../build/yui/yui.js"></script>
9
 
</head>
10
 
<body class="yui3-skin-sam">
11
 
 
12
 
        <h1>Opera Focus and Blur Event Test</h1>
13
 
 
14
 
        <h2>Background</h2>
15
 
        <p>
16
 
                By default the <code>focus</code> and <code>blur</code> events do not 
17
 
                bubble.  This is problematic for developers wishing to listen for these 
18
 
                events via event delegation.  Use of capture phase event listeners for 
19
 
                <code>focus</code> and <code>blur</code> is useful in that they enable 
20
 
                the use of these events when using event delegation.
21
 
        </p>
22
 
        <p>
23
 
        Opera implements capture phase events per spec rather than
24
 
        the more useful way it is implemented in other browsers:
25
 
        The event doesn't fire on a target unless there is a
26
 
        listener on an element in the target's ancestry.  If a
27
 
        capture phase listener is added only to the element that
28
 
        will be the target of the event, the listener won't fire.               
29
 
        </p>
30
 
        <p>
31
 
                To work around the implementation of capture phase events in Opera, 
32
 
                the YUI3 Event Utility uses the <code>DOMFocusIn</code> and 
33
 
                <code>DOMFocusOut</code> events 
34
 
                rather than capture phase listeners for <code>focus</code> and 
35
 
                <code>blur</code>.
36
 
        </p>
37
 
        
38
 
        <h2>Using this Test</h2>
39
 
        <p>
40
 
                Use the keyboard or mouse to place focus into and the remove focus 
41
 
                from the following text box.  You should see a log message appear 
42
 
                for each event in Opera.
43
 
        </p>
44
 
 
45
 
 
46
 
        <input type="text" id="text-1">
47
 
 
48
 
        <script type="text/javascript">
49
 
 
50
 
        YUI({
51
 
        logExclude: {   
52
 
                Dom: true, 
53
 
                        Selector: true, 
54
 
                        Node: true, 
55
 
                        attribute: true, 
56
 
                        base: true, 
57
 
                        event: true, 
58
 
                        widget: true },
59
 
        lazyEventFacade: true
60
 
        }).use('console', 'node', 'event-focus', function (Y) {
61
 
 
62
 
                        (new Y.Console()).render();
63
 
                        
64
 
                        var textBox = document.getElementById("text-1");
65
 
 
66
 
                        //      The following standard capture phase focus and blur event 
67
 
                        //      listeners will not be called in Opera.
68
 
                        
69
 
                        textBox.addEventListener("focus", function () {
70
 
                                
71
 
                                Y.log("text-1 standard DOM capture phase focus listener called");
72
 
                                
73
 
                        }, true);
74
 
 
75
 
                        textBox.addEventListener("blur", function () {
76
 
                                
77
 
                                Y.log("text-1 standard DOM capture phase blur listener called");
78
 
                                
79
 
                        }, true);                       
80
 
 
81
 
 
82
 
                        //      The following YUI3 focus and blur event listeners WILL be 
83
 
                        //      called in Opera.
84
 
 
85
 
                        Y.on("focus", function () {
86
 
                                
87
 
                                Y.log("focus listener called for text box!");
88
 
                                
89
 
                        }, "#text-1");
90
 
                        
91
 
                        Y.on("blur", function () {
92
 
                                
93
 
                                Y.log("blur listener called for text box!");
94
 
                                
95
 
                        }, "#text-1");                  
96
 
 
97
 
                });
98
 
 
99
 
        </script>
100
 
 
101
 
</body>
102
 
</html>