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

Side by Side Diff: chrome/common/extensions/docs/js/api_page_generator.js

Issue 10832363: In the extension docs builder, allow DOM nodes to be specified as "volatile" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview This file is the controller for generating extension 6 * @fileoverview This file is the controller for generating extension
7 * doc pages. 7 * doc pages.
8 * 8 *
9 * It expects to have available via XHR (relative path): 9 * It expects to have available via XHR (relative path):
10 * 1) API_TEMPLATE which is the main template for the api pages. 10 * 1) API_TEMPLATE which is the main template for the api pages.
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 'jsinstance']; 415 'jsinstance'];
416 416
417 var nodes = root.getElementsByTagName('*'); 417 var nodes = root.getElementsByTagName('*');
418 var displayNone = []; 418 var displayNone = [];
419 419
420 for (var i = 0; i < nodes.length; i++) { 420 for (var i = 0; i < nodes.length; i++) {
421 var n = nodes[i] 421 var n = nodes[i]
422 422
423 // Delete nodes which are hidden. There are lots of these since jsdisplay 423 // Delete nodes which are hidden. There are lots of these since jsdisplay
424 // just hides nodes, not deletes them. 424 // just hides nodes, not deletes them.
425 if (n.style && n.style.display === 'none') { 425 if (!n.hasAttribute('volatile') && n.style && n.style.display === 'none') {
426 displayNone.push(n); 426 displayNone.push(n);
427 continue; 427 continue;
428 } else {
429 n.removeAttribute('volatile');
428 } 430 }
429 431
430 // Delete empty style attributes (this can happen when jsdisplay causes 432 // Delete empty style attributes (this can happen when jsdisplay causes
431 // display values other than 'none'). 433 // display values other than 'none').
432 var styleAttribute = n.getAttribute('style'); 434 var styleAttribute = n.getAttribute('style');
433 if (typeof(styleAttribute) === 'string' && styleAttribute.trim() === '') { 435 if (typeof(styleAttribute) === 'string' && styleAttribute.trim() === '') {
434 n.removeAttribute('style'); 436 n.removeAttribute('style');
435 } 437 }
436 438
437 // Remove jstemplate attributes from nodes that stick around. 439 // Remove jstemplate attributes from nodes that stick around.
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 } 857 }
856 if (a.name > b.name) { 858 if (a.name > b.name) {
857 return 1; 859 return 1;
858 } 860 }
859 return 0; 861 return 0;
860 } 862 }
861 863
862 function disableDocs(obj) { 864 function disableDocs(obj) {
863 return !!obj.nodoc; 865 return !!obj.nodoc;
864 } 866 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/extensions/samples.html ('k') | chrome/common/extensions/docs/static/samples.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698