core.js 917 B

123456789101112131415161718192021222324252627
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. "use strict";
  5. module.metadata = {
  6. "stability": "unstable"
  7. };
  8. var { Ci } = require("chrome");
  9. var method = require("../../method/core");
  10. // Returns DOM node associated with a view for
  11. // the given `value`. If `value` has no view associated
  12. // it returns `null`. You can implement this method for
  13. // this type to define what the result should be for it.
  14. let getNodeView = method("getNodeView");
  15. getNodeView.define(x =>
  16. x instanceof Ci.nsIDOMNode ? x :
  17. x instanceof Ci.nsIDOMWindow ? x :
  18. null);
  19. exports.getNodeView = getNodeView;
  20. exports.viewFor = getNodeView;
  21. let getActiveView = method("getActiveView");
  22. exports.getActiveView = getActiveView;