简体   繁体   English

文档 Object Model ( DOM ) 中的“型号”是什么意思?

[英]What's the meaning of "Model" in Document Object Model ( DOM )?

I'm learning web development and came across the concept of DOM.我正在学习 web 开发并遇到了 DOM 的概念。 There are many resources which have explained what is DOM and what it does.有很多资源解释了什么是 DOM 以及它的作用。

But I couldn't find any resource explaining meaning of "Model" in "Document Object Model ( DOM )".但我在“文档 Object Model (DOM)”中找不到任何解释“模型”含义的资源。 What does it mean?这是什么意思?

I've found couple of good answers as below我找到了几个很好的答案,如下所示

  1. In programming the term "model" often refers to a data structure.在编程中,术语“模型”通常指的是数据结构。 For the DOM, it is referring to the structure of the document.对于 DOM,它指的是文档的结构。 The document is an object with properties and the structure of it all is predetermined by the model.该文档是具有属性的 object,其结构由 model 预先确定。

  2. In a general sense, “model” can just be the shape of data.在一般意义上,“模型”可以只是数据的形状。 Like in a language like TypeScript, I might define a person as:就像在 TypeScript 这样的语言中,我可以将一个人定义为:

     interface Person { name: string age: number address: { house: number street: string city: string state: string zip: string } phones: string[] }

That is just the model for how I represent a “person” in my data.这只是 model 我如何在我的数据中表示一个“人”。

In a more general sense, the DOM is just a model, an abstract representation of what is on the screen.在更一般的意义上,DOM 只是 model,是屏幕上内容的抽象表示。 It (the data and therefore the model) has a certain shape and hierarchy.它(数据和模型)具有一定的形状和层次结构。

As the name suggests, it's a model for things In this case, model of the document A model is as the plan of city or house, it describes how it look顾名思义,它是model for things 在这种情况下,文档A model的model是城市或房屋的平面图,它描述了它的外观

The model describe and give you the representation of your document model 描述并为您提供文档的表示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM