GithubHelp home page GithubHelp logo

boy-jer / jquery-doc-and-win Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brandonaaron/jquery-doc-and-win

1.0 2.0 0.0 114 KB

Two helper methods for retrieving the document and window objects.

Home Page: http://brandonaaron.net/code

jquery-doc-and-win's Introduction

doc-and-win

A jQuery plugin that adds two helper methods to retrieve the window and document objects. When called on an iframe, it returns the iframe's document or window (depending on the method you used). When called on an element, it returns the element's parent document or window. If a document object is passed in, it returns itself or the window it belongs to. If a window object is passed in, it returns the document of the window or itself.

Both the .doc() and .win() methods return the document or window for each matched element.

This plugin will be best used with jQuery 1.3.3+ which has better support for other windows and documents.

Examples

$('iframe').doc() // iframe document
$('iframe').win() // iframe window

// bind event to a tags in iframe
$('iframe').doc().find('a').click(fn);

$('iframe').doc().find('a').doc() // iframe document

$('p').doc() // return parent document
$('p').win() // return parent window

$(document).doc() // return document
$(document).win() // return document.defaultView || document.parentWindow

$(window).doc() // return window.document
$(window).win() // return window

License

The doc-and-win plugin is dual licensed (just like jQuery) under the MIT and GPL licenses.

Copyright (c) 2009 Brandon Aaron

jquery-doc-and-win's People

Contributors

brandonaaron avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.