zoukankan      html  css  js  c++  java
  • Browser environment

    目录
    1.The global structur

    2.Summary

    The browser provides us with a hierarchy of objects which we can use to control and access various information about time, screen, page, elements on a page etc.

    The global structure

    The browser provides access to a large hierarchy of objects for developers to manipulate. You can see a part of it below:

    On the top is the window, also called global object.

    All other objects form 3 groups.

    Document Object Model (DOM)
    document and related objects allow to access contents of the page, modify elements etc. Most interaction with HTML is handled here.

    There is a pack of standards for DOM, developed by W3C. You can find it at W3C DOM page. There are three levels of DOM, each level expands on the previous. Modern browsers generally support pre-W3C features from the browser dark-ages, called DOM 0.

    Browser Object Model (BOM)
    BOM is a pack of objects that allow to control the browser, e.g change current URL, access frames, do background requests to server with XMLHttpRequest etc. Functions like alert,confirm,prompt also belong BOM, they are provided by the browser.

    Many BOM features are standartized in HTML5, but not all.

    JavaScript objects and functions
    JavaScript itself is a language which gives us access to DOM, BOM and provides objects and functions of its own.

    JavaScript follows the ECMA-262 standard.

    The global window object mixes browser window functionality (methods focus(),open() etc) with being a JavaScript global object. That’s why it is both green and red.

    Summary

    While this information is theoretical, the terms are always good to know.

    It is advisable that you read DOM and other standards as it helps when problem solving and serves general educational purposes.

    And, by the way, the components can be used separately.

    • JavaScript is a general purpose language, you can use it in command line, build a Node.JS-based server in it.
    • BOM and DOM can be controlled by an external program or a plugin, using browser API, not just with JavaScript. E.g Webdriver unit-testing framework works like that.
    • DOM is also used for XML documents, not just HTML, and of course not limited to frontend 
  • 相关阅读:
    Linux 创建sftp用户并限制目录权限
    idea操作maven时控制台中文显示乱码/maven项目启动方式
    Docker 容器镜像删除
    Golang 在 Mac、Linux、Windows 下如何交叉编译
    Linux后台运行Jar方法
    MAC安装JDK及环境变量配置
    Docker 容器镜像删除
    UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
    《设计模式之禅》之状态模式
    《设计模式之禅》之访问者模式
  • 原文地址:https://www.cnblogs.com/hephec/p/4575780.html
Copyright © 2011-2022 走看看