Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: appengine_apps/chromium_status/static/js/common/dom_util.js

Issue 778533003: Moved chromium_status to appengine/ (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Helper utility functions for manipulating the DOM.
7 */
8 var DomUtil = {};
9
10 /**
11 * Toggles the visibility on a node.
12 *
13 * @param {DOMNode} n The node to show/hide.
14 * @param {boolean} display False to hide the node.
15 */
16 DomUtil.DisplayNode = function(n, display) {
17 n.style.display = display ? "" : "none";
18 };
19
20 /**
21 * Appends a new node with tag |type| to |parent|.
22 *
23 * @param {DOMNode} parent
24 * @param {string} type
25 * @return {DOMNode} The node that was just created.
26 */
27 DomUtil.AddNode = function(parent, type) {
28 if (!type) {
29 throw ("type must be defined");
30 }
31 var doc = parent.ownerDocument;
32 var n = doc.createElement(type);
33 parent.appendChild(n);
34 return n;
35 };
36
37 /**
38 * Adds text to node |parent|.
39 *
40 * @param {DOMNode} parent
41 * @param {string} text
42 */
43 DomUtil.AddText = function(parent, text) {
44 var doc = parent.ownerDocument;
45 var n = doc.createTextNode(text);
46 parent.appendChild(n);
47 return n;
48 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698