Chromium Code Reviews| Index: ui/webui/resources/js/util.js |
| diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js |
| index 79f8d85d487da579bdc04e7879e08ac38fb16d87..63e3279f8053b00772a4523a2e65bc3b1e70d953 100644 |
| --- a/ui/webui/resources/js/util.js |
| +++ b/ui/webui/resources/js/util.js |
| @@ -321,3 +321,43 @@ function ensureTransitionEndEvent(el, timeOut) { |
| cr.dispatchSimpleEvent(el, 'webkitTransitionEnd'); |
| }, timeOut); |
| } |
| + |
| +/** |
| + * Alias for document.scrollTop getter. |
| + * @param {Node} doc The document node where information will be queried from. |
|
Dan Beam
2013/11/11 19:44:04
all of these should be @param {!HTMLDocument}
|
| + * @return {value} The Y document scroll offset. |
|
Dan Beam
2013/11/11 19:44:04
and all of these, @return {number}
|
| + */ |
| +function scrollTopForDocument(doc) |
| +{ |
| + return doc.documentElement.scrollTop || doc.body.scrollTop; |
| +} |
|
Dan Beam
2013/11/11 19:44:04
please match chrome-style not blink (2\s indent, b
|
| + |
| +/** |
| + * Alias for document.scrollTop setter. |
| + * @param {Node} doc The document node where information will be queried from. |
| + * @param {value} value The Y target scroll offset. |
| + */ |
| +function setScrollTopForDocument(doc, value) |
| +{ |
| + doc.documentElement.scrollTop = doc.body.scrollTop = value; |
| +} |
| + |
| +/** |
| + * Alias for document.scrollLeft getter. |
| + * @param {Node} doc The document node where information will be queried from. |
| + * @return {value} The X document scroll offset. |
| + */ |
| +function scrollLeftForDocument(doc) |
| +{ |
| + return doc.documentElement.scrollLeft || doc.body.scrollLeft; |
| +} |
| + |
| +/** |
| + * Alias for document.scrollLeft setter. |
| + * @param {Node} doc The document node where information will be queried from. |
| + * @param {value} value The target X scroll offset. |
| + */ |
| +function setScrollLeftForDocument(doc, value) |
| +{ |
|
Dan Beam
2013/11/11 19:44:04
is there any reason why we shouldn't simply be che
|
| + doc.documentElement.scrollLeft = doc.body.scrollLeft = value; |
| +} |