summaryrefslogtreecommitdiff
path: root/frontend/beta/js/Clipperz/YUI/DomHelper.js
Unidiff
Diffstat (limited to 'frontend/beta/js/Clipperz/YUI/DomHelper.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/beta/js/Clipperz/YUI/DomHelper.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/frontend/beta/js/Clipperz/YUI/DomHelper.js b/frontend/beta/js/Clipperz/YUI/DomHelper.js
index 05edc49..2c0ba34 100644
--- a/frontend/beta/js/Clipperz/YUI/DomHelper.js
+++ b/frontend/beta/js/Clipperz/YUI/DomHelper.js
@@ -1,70 +1,68 @@
1/* 1/*
2 2
3Copyright 2008-2011 Clipperz Srl 3Copyright 2008-2013 Clipperz Srl
4 4
5This file is part of Clipperz Community Edition. 5This file is part of Clipperz, the online password manager.
6Clipperz Community Edition is an online password manager.
7For further information about its features and functionalities please 6For further information about its features and functionalities please
8refer to http://www.clipperz.com. 7refer to http://www.clipperz.com.
9 8
10* Clipperz Community Edition is free software: you can redistribute 9* Clipperz is free software: you can redistribute it and/or modify it
11 it and/or modify it under the terms of the GNU Affero General Public 10 under the terms of the GNU Affero General Public License as published
12 License as published by the Free Software Foundation, either version 11 by the Free Software Foundation, either version 3 of the License, or
13 3 of the License, or (at your option) any later version. 12 (at your option) any later version.
14 13
15* Clipperz Community Edition is distributed in the hope that it will 14* Clipperz is distributed in the hope that it will be useful, but
16 be useful, but WITHOUT ANY WARRANTY; without even the implied 15 WITHOUT ANY WARRANTY; without even the implied warranty of
17 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU Affero General Public License for more details. 17 See the GNU Affero General Public License for more details.
19 18
20* You should have received a copy of the GNU Affero General Public 19* You should have received a copy of the GNU Affero General Public
21 License along with Clipperz Community Edition. If not, see 20 License along with Clipperz. If not, see http://www.gnu.org/licenses/.
22 <http://www.gnu.org/licenses/>.
23 21
24*/ 22*/
25 23
26if (typeof(Clipperz) == 'undefined') { Clipperz = {}; } 24if (typeof(Clipperz) == 'undefined') { Clipperz = {}; }
27if (typeof(Clipperz.ext) == 'undefined') { Clipperz.ext = {}; } 25if (typeof(Clipperz.ext) == 'undefined') { Clipperz.ext = {}; }
28 26
29/** 27/**
30 * @class Clipperz.YUI.DomHelper 28 * @class Clipperz.YUI.DomHelper
31 * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM. 29 * Utility class for working with DOM and/or Templates. It transparently supports using HTML fragments or DOM.
32 * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>. 30 * For more information see <a href="http://www.jackslocum.com/yui/2006/10/06/domhelper-create-elements-using-dom-html-fragments-or-templates/">this blog post with examples</a>.
33 * @singleton 31 * @singleton
34 */ 32 */
35Clipperz.YUI.DomHelper = new function(){ 33Clipperz.YUI.DomHelper = new function(){
36 /**@private*/ 34 /**@private*/
37 var d = document; 35 var d = document;
38 var tempTableEl = null; 36 var tempTableEl = null;
39 /** True to force the use of DOM instead of html fragments @type Boolean */ 37 /** True to force the use of DOM instead of html fragments @type Boolean */
40 this.useDom = false; 38 this.useDom = false;
41 var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i; 39 var emptyTags = /^(?:base|basefont|br|frame|hr|img|input|isindex|link|meta|nextid|range|spacer|wbr|audioscope|area|param|keygen|col|limittext|spot|tab|over|right|left|choose|atop|of)$/i;
42 /** 40 /**
43 * Applies a style specification to an element 41 * Applies a style specification to an element
44 * @param {String/HTMLElement} el The element to apply styles to 42 * @param {String/HTMLElement} el The element to apply styles to
45 * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or 43 * @param {String/Object/Function} styles A style specification string eg "width:100px", or object in the form {width:"100px"}, or
46 * a function which returns such a specification. 44 * a function which returns such a specification.
47 */ 45 */
48 this.applyStyles = function(el, styles){ 46 this.applyStyles = function(el, styles){
49 if(styles){ 47 if(styles){
50 var D = YAHOO.util.Dom; 48 var D = YAHOO.util.Dom;
51 if (typeof styles == "string"){ 49 if (typeof styles == "string"){
52 var re = /\s?([a-z\-]*)\:([^;]*);?/gi; 50 var re = /\s?([a-z\-]*)\:([^;]*);?/gi;
53 var matches; 51 var matches;
54 while ((matches = re.exec(styles)) != null){ 52 while ((matches = re.exec(styles)) != null){
55 D.setStyle(el, matches[1], matches[2]); 53 D.setStyle(el, matches[1], matches[2]);
56 } 54 }
57 }else if (typeof styles == "object"){ 55 }else if (typeof styles == "object"){
58 for (var style in styles){ 56 for (var style in styles){
59 D.setStyle(el, style, styles[style]); 57 D.setStyle(el, style, styles[style]);
60 } 58 }
61 }else if (typeof styles == "function"){ 59 }else if (typeof styles == "function"){
62 Clipperz.YUI.DomHelper.applyStyles(el, styles.call()); 60 Clipperz.YUI.DomHelper.applyStyles(el, styles.call());
63 } 61 }
64 } 62 }
65 }; 63 };
66 64
67 // build as innerHTML where available 65 // build as innerHTML where available
68 /** @ignore */ 66 /** @ignore */
69 var createHtml = function(o){ 67 var createHtml = function(o){
70 var b = ''; 68 var b = '';