Home  >  Q&A  >  body text

html5 - 请教大家几个前端问题

  1. html有哪些兼容性?如何解决这些兼容性,解决方法的原理是什么?

  2. BOM与DOM的关系?

  3. 让png在ie6下透明显示的js(DD_belatedPNG)工作原理是什么?

  4. 项目中如何优化或者压缩代码?如何提高性能?优化后结果好坏是通过什么判断的?

高洛峰高洛峰2766 days ago423

reply all(5)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 11:29:02

    Various browsers have different compatibility. It is recommended to use the JQuery framework for development, which has strong compatibility; BOM is the browser object model, and there is no set of standards. Ajax's XMLHttpRequest is the browser object and is not used much, while DOM is Document Object Model, in the world of DOM parsing, there is a saying that everything is a node. Please ask the following questions on Baidu

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:29:02

    First question
    1. There is no compatibility problem with HTML, it is a problem with the browser rendering method and kernel.
    The compatibility you are talking about is nothing more than a problem of DOM or CSS.
    2.BOM is the browser object model,
    DOM is the Document Object Model
    3. I don’t know the principle, I just know that this thing is always calculating, which consumes a lot of performance
    4. Optimization is something you are constantly doing and something you think about yourself. For example, can your node events be done using proxies? Can some pictures be merged into one picture? , whether js code can be merged into one js file.

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 11:29:02

    4 You can use grunt and gulp

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:29:02

    I’m here to answer the second question, let’s talk about it javascript before answering! (Maybe I’m going too far)
    JavaScript is a programming language. Generally speaking, a programming language must have basic data types, advanced data types, operators, keywords, some built-in functions, and functions for operating data.

    The running environment of JavaScript is the v8 engine. When the v8 engine is part of the browser, the browser can provide it with some browser APIs (something advertisers often do), such as modifying the value in the browser's address bar and triggering the browser's history to go back/ Forward/refresh, view browser version information, etc. JavaScript runs on the v8 engine, and v8 allows JavaScript to call these APIs. So the JavaScript on the browser has location, history, navigator and other global built-in objects that should originally belong to the browser. This part is not necessary for the JavaScript programming language, but it is very useful. This part is the BOM (Browser Object) in JavaScript. Model).

    When the browser parses an HTML document, it will parse the HTML into a tree-structured object (document tree). In this process, the browser has the 'permissions' for any operation on this object, and then the browser passes some of the 'permissions' through the v8 engine so that JavaScript can also have them. Because in web pages, this is particularly useful and is used frequently. , the browser then makes this document object almost completely usable by JavaScript. This document object is the DOM (Document Object Model) in JavaScript.

    The above at least makes it clear what browser objects and document objects are. Next, let’s talk about the model.

    A model is an expression form of the system, process, thing or concept under study. For a program object, the model must be able to reflect its core structure and describe its core. Looking at the DOM again, it is the root of the document tree. The interface provided allows you to see that this object can be described as a tree structure. Similarly, you can see the core working components of the browser from the BOM (for In terms of browsing pages). This is the explanation of the model.

    Write at the end:

    The above is purely personal chatter, just treat it as a free time and do not judge whether it is right or wrong.

    reply
    0
  • 黄舟

    黄舟2017-04-17 11:29:02

    1.html compatibility? In fact, it cannot be said that HTML does not say which browser it is targeted at, but there are some rules that need to be paid attention to. For example, before HTML5, block-level elements cannot be nested inside non-block-level elements. Other posters can go online to learn more about writing methods and specifications.
    2. BOM and DOM are not explained. There are too many explanations on the Internet. When doing technology, you must learn to find answers by yourself instead of asking questions and waiting!
    3. PNG pictures can be realized using filters under IE6. The questioner can go to my website to have a look and summarize these things.
    4. Performance optimization, not much to say, just go to my website and read it, practice it yourself and then write articles.

    reply
    0
  • Cancelreply