资讯专栏INFORMATION COLUMN

【譯】12.2.4 解析狀態 Parse state - HTML Standard

oogh / 1730人阅读

摘要:否則,該元素指針不為,切換插入模式為,并終止這些步驟。否則,如果是中的元素類型之一,終止於失敗狀態。否則,設置為打開元素堆棧中的前一個元素,并返回到步驟。當進入元素時附加該標記,這用於防止格式化洩漏到元素。

HTML
Living Standard — Last Updated 20 August 2017
12.2.4 Parse state
Parts of this specification are © Copyright 2004-2014 Apple Inc., Mozilla Foundation, and Opera Software ASA.
You are granted a license to use, reproduce and create derivative works of this document.

12.2.4.1 插入模式 The insertion mode

The insertion mode is a state variable that controls the primary operation of the tree construction stage.

insertion mode 是一個狀態變量,它控制樹在構建階段的主要操作。


Initially, the insertion mode is "initial". It can change to "before html", "before head", "in head", "in head noscript", "after head", "in body", "text", "in table", "in table text", "in caption", "in column group", "in table body", "in row", "in cell", "in select", "in select in table", "in template", "after body", "in frameset", "after frameset", "after after body", and "after after frameset" during the course of the parsing, as described in the tree construction stage. The insertion mode affects how tokens are processed and whether CDATA sections are supported.

最初,insertion modeinitial。在解析過程中,它可以改變為 before htmlbefore headin headin head noscriptafter headin bodytextin tablein table textin captionin column groupin table bodyin rowin cellin selectin select in tablein templateafter bodyin framesetafter framesetafter after bodyafter after frameset,正如 樹構造 階段中所描述的。insertion mode 影響如何處理 tokens ,以及是否支持 CDATA 區段。


Several of these modes, namely "in head", "in body", "in table", and "in select", are special, in that the other modes defer to them at various times. When the algorithm below says that the user agent is to do something "using the rules for the m insertion mode", where m is one of these modes, the user agent must use the rules described under the m insertion mode"s section, but must leave the insertion mode unchanged unless the rules in m themselves switch the insertion mode to a new value.

in heaiin bodyin tableselect,上述幾種模式是特殊的,因為其他模式在不同時候對他們進行響應。當下面的算法表明用戶代理是做某事「使用規則到達插入模式m」,這里的m是上述特殊模式之一,用戶代理必需使用在下面 m 插入模式的章節中描述的規則,但必需保持插入模式不變,除非該規則在 m 自身切換 insertion mode 為新值。


When the insertion mode is switched to "text" or "in table text", the original insertion mode is also set. This is the insertion mode to which the tree construction stage will return.

當插入模式切換為 textin table text 時,也設置了原始插入模式。這是樹構建階段將返回的插入模式。


Similarly, to parse nested template elements, a stack of template insertion modes is used. It is initially empty. The current template insertion mode is the insertion mode that was most recently added to the stack of template insertion modes. The algorithms in the sections below will push insertion modes onto this stack, meaning that the specified insertion mode is to be added to the stack, and pop insertion modes from the stack, which means that the most recently added insertion mode must be removed from the stack.

類似的,使用一個模版插入模式的堆棧,來解析嵌套 template 元素。它最初是空的。當前插入模式是最近添加到插入模式堆棧的插入模式。下面章節中的算法將插入模式 push 到這個堆棧中,這意味著指定的插入模式將添加到堆棧中;並且從堆棧中 pop 插入模式,這意味著必需從堆棧中移除最近添加的插入模式。


When the steps below require the UA to reset the insertion mode appropriately, it means the UA must follow these steps:

當下面的步驟要求用戶代理適當的重置插入模式,意味著用戶代理必需遵循這些步驟:

Let last be false.
lastfalse

Let node be the last node in the stack of open elements.
node 為打開元素堆棧的最後一個節點。

Loop: If node is the first node in the stack of open elements, then set last to true, and, if the parser was originally created as part of the HTML fragment parsing algorithm (fragment case), set node to the context element passed to that algorithm.
Loop:如果 node 是打開元素堆棧的第一個節點,那麼最後設置為 true ,並且,如果解析器最初是作為 HTML 片段解析算法(fragment case)的一部分創建的,那麼 node 設置為傳遞給該算法的上下文元素。

If node is a select element, run these substeps:
如果 node 是一個 select 元素,運行這些子步驟:

If last is true, jump to the step below labeled done.
如果 lasttrue,跳到下面的步驟標記 done

Let ancestor be node.
ancestornode

Loop: If ancestor is the first node in the stack of open elements, jump to the step below labeled done.
Loop:如果 ancestor 是打開元素堆棧的第一個節點,跳到下面的步驟標記 done

Let ancestor be the node before ancestor in the stack of open elements.
ancestor 為打開元素堆棧之前的 ancestor

If ancestor is a template node, jump to the step below labeled done.
如果 ancestor 是一個 template 節點,跳到下面的步驟標記 done

If ancestor is a table node, switch the insertion mode to "in select in table" and abort these steps.
如果 ancestor 是一個 table 節點,將插入模式切換為 in select in table,并終止這些步驟。

Jump back to the step labeled loop.
跳轉回步驟標記 Loop

Done: Switch the insertion mode to "in select" and abort these steps.
Done:切換插入模式為 in select,并終止這些步驟。

If node is a td or th element and last is false, then switch the insertion mode to "in cell" and abort these steps.
如果 nodetdth 元素,並且 lastfalse,那麼切換插入模式為 in cell,并終止這些步驟。

If node is a tr element, then switch the insertion mode to "in row" and abort these steps.
如果 nodetr 元素,那麼切換插入模式為 in row,并終止這些步驟。

If node is a tbody, thead, or tfoot element, then switch the insertion mode to "in table body" and abort these steps.
如果 nodetbodytheadtfoot 元素,那麼切換插入模式為 in table body,并終止這些步驟。

If node is a caption element, then switch the insertion mode to "in caption" and abort these steps.
如果 nodecaption 元素,那麼切換插入模式為 in caption,并終止這些步驟。

If node is a colgroup element, then switch the insertion mode to "in column group" and abort these steps.
如果 nodecolgroup 元素,那麼切換插入模式為 in column group,并終止這些步驟。

If node is a table element, then switch the insertion mode to "in table" and abort these steps.
如果 nodetabla 元素,那麼切換插入模式為 in table,并終止這些步驟。

If node is a template element, then switch the insertion mode to the current template insertion mode and abort these steps.
如果 nodetemplate 元素,那麼切換插入模式為當前模版插入模式,并終止這些步驟。

If node is a head element and last is false, then switch the insertion mode to "in head" and abort these steps.
如果 nodehead 元素,並且 lastfalse,那麼切換插入模式為 in haed,并終止這些步驟。

If node is a body element, then switch the insertion mode to "in body" and abort these steps.
如果 nodebody 元素,那麼切換插入模式為 in body,并終止這些步驟。

If node is a frameset element, then switch the insertion mode to "in frameset" and abort these steps. (fragment case)
如果 nodeframeset 元素,那麼切換插入模式為 in frameset,并終止這些步驟。(fragment case)

If node is an html element, run these substeps:
如果 nodehtml 元素,運行這些子步驟:

If the head element pointer is null, switch the insertion mode to "before head" and abort these steps. (fragment case)
如果 head 元素指針為 null,切換插入模式為 before head,并終止這些步驟。(fragment case)

Otherwise, the head element pointer is not null, switch the insertion mode to "after head" and abort these steps.
否則,該 head 元素指針不為 null,切換插入模式為 after head,并終止這些步驟。

If last is true, then switch the insertion mode to "in body" and abort these steps. (fragment case)
如果 lasttrue,那麼切換插入模式為 in body,并終止這些步驟。(fragment case)

Let node now be the node before node in the stack of open elements.
設現在的 node 為打開元素堆棧中的節點的之前的 node

Return to the step labeled loop.
回到步驟標籤 Loop


12.2.4.2 打開元素的堆棧 The stack of open elements

Initially, the stack of open elements is empty. The stack grows downwards; the topmost node on the stack is the first one added to the stack, and the bottommost node of the stack is the most recently added node in the stack (notwithstanding when the stack is manipulated in a random access fashion as part of the handling for misnested tags).

最初,打開元素的堆棧是空的。堆棧向下生長;堆棧最頂部的 node 是第一個添加到堆棧的節點,並且堆棧最底部的 node 是最近添加到堆棧的節點(儘管在處理錯誤嵌套的標籤時,堆棧以隨機的訪問方式控制)。


Note: The "before html" insertion mode creates the html document element, which is then added to the stack.
Note: 在 before html 插入模式下創建 html 文檔元素,然後將其添加到堆棧中。


Note: In the fragment case, the stack of open elements is initialized to contain an html element that is created as part of that algorithm. (The fragment case skips the "before html" insertion mode.)
Note: 在碎片容器中,開放元素堆棧已被初始化為包含一個 html 元素,這是作為它的算法的一部分創建的(碎片容器跳過了 before html插入模式)。


The html node, however it is created, is the topmost node of the stack. It only gets popped off the stack when the parser finishes.

無論如何,都將創建html 節點,並且它將是堆棧最頂部的節點。只有當解析完成,它才會從堆棧中彈出。


The current node is the bottommost node in this stack of open elements.

當前節點是在這個打開元素堆棧中最底部的的節點。


The adjusted current node is the context element if the parser was created by the HTML fragment parsing algorithm and the stack of open elements has only one element in it (fragment case); otherwise, the adjusted current node is the current node.

如果解析器是在 HTML 碎片解析算法中創建的,並且打開元素堆棧中只有一個元素,那麼校正后的當前節點為上下文元素;否則,校正后的當前節點就是當前節點


Elements in the stack of open elements fall into the following categories:

在打開元素堆棧中的元素分為下列類別:

Special 特殊的

The following elements have varying levels of special parsing rules: HTML"s address, applet, area, article, aside, base, basefont, bgsound, blockquote, body, br, button, caption, center, col, colgroup, dd, details, dir, div, dl, dt, embed, fieldset, figcaption, figure, footer, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, header, hgroup, hr, html, iframe, img, input, keygen, li, link, listing, main, marquee, menu, meta, nav, noembed, noframes, noscript, object, ol, p, param, plaintext, pre, script, section, select, source, style, summary, table, tbody, td, template, textarea, tfoot, th, thead, title, tr, track, ul, wbr, xmp; MathML mi, MathML mo, MathML mn, MathML ms, MathML mtext, and MathML annotation-xml; and SVG foreignObject, SVG desc, and SVG title.

以下元素擁有不同程度的特殊解析規則:HTML 的 addressapplet、areaarticle、asidebasebasefontbgsoundblockquotebodybrbuttoncaptioncentercolcolgroupdddetailsdirdivdldtembedfieldsetfigcaptionfigurefooterformframeframeseth1h2h3h4h5h6headheaderhgrouphrhtmliframeimginputkeygenlilinklistingmainmarqueemenumetanavnoembednoframesnoscriptobjectolpparamplaintextprescriptsectionselectsourcestylesummarytabletbodytdtemplatetextareatfootththeadtitletrtrackulwbrxmpMathML miMathML moMathML mnMathML msMathML mtextMathML annotation-xml;以及 SVG foreignObjectSVG descSVG title

Note: An image start tag token is handled by the tree builder, but it is not in this list because it is not an element; it gets turned into an img element.
Note: 在樹構造中會處理image 起始標籤,但它不在這個列表中,因為它不是一個元素;它變成了 img 元素。

Formatting 格式化

The following HTML elements are those that end up in the list of active formatting elements: a, b, big, code, em, font, i, nobr, s, small, strike, strong, tt, and u.

下列 HTML 元素在現役格式化元素的列表中結束:abbigcodeemfontinobrssmallstrikestrongttu

Ordinary 普通的

All other elements found while parsing an HTML document.

在解析 HTML 文檔時發現的所有其他元素。

Typically, the special elements have the start and end tag tokens handled specifically, while ordinary elements" tokens fall into "any other start tag" and "any other end tag" clauses, and some parts of the tree builder check if a particular element in the stack of open elements is in the special category. However, some elements (e.g., the option element) have their start or end tag tokens handled specifically, but are still not in the special category, so that they get the ordinary handling elsewhere.
通常,當普通元素在「任何其他起始標籤」和「任何其他結束標籤」之間作為子句,特殊元素的起始標籤和結束標籤令牌會進行特殊處理,並且樹構造器的某些部分會檢查特定元素在打開元素堆棧中是否是屬於特殊類別。然而,某些元素(例如,option 元素)有特殊的起始標籤或結束標籤令牌處理,但它仍然不在特殊類別中,這是為了在其他地方得到普通處理。


The stack of open elements is said to have an element target node in a specific scope consisting of a list of element types list when the following algorithm terminates in a match state:

當以下算法在匹配狀態終止時,該打開元素堆棧被認為在特定作用域中存在元素目標節點,算法包含一個元素類型的列表 list

Initialize node to be the current node (the bottommost node of the stack).
初始化 node 為當前節點(堆棧中最底部的節點)。

If node is the target node, terminate in a match state.
如果 node 是目標節點,終止於匹配狀態。

Otherwise, if node is one of the element types in list, terminate in a failure state.
否則,如果 nodelist 中的元素類型之一,終止於失敗狀態。

Otherwise, set node to the previous entry in the stack of open elements and return to step 2. (This will never fail, since the loop will always terminate in the previous step if the top of the stack — an html element — is reached.)
否則,設置 node 為打開元素堆棧中的前一個元素,并返回到步驟 2 。(這永遠不會失敗,因為如果到達了堆棧的頂部 —— 一個 html 元素,這個循環將在前一個步驟終止。)


The stack of open elements is said to have a particular element in scope when it has that element in the specific scope consisting of the following element types:

當下列元素類型作為 list 時,符合在特定作用域中存在元素目標節點,該打開元素堆棧被認為在作用域中存在特定的元素

applet

caption

html

table

td

th

marquee

object

template

MathML mi

MathML mo

MathML mn

MathML ms

MathML mtext

MathML annotation-xml

SVG foreignObject

SVG desc

SVG title


The stack of open elements is said to have a particular element in list item scope when it has that element in the specific scope consisting of the following element types:

當下列元素類型作為 list 時,符合在特定作用域中存在元素目標節點,該打開元素堆棧被認為在列表條目作用域中存在特定的元素

All the element types listed above for the has an element in scope algorithm.
算法 在作用域中有特定的元素 列出的所有元素。

ol in the HTML namespace
HTML 命名空間中的 ol

ul in the HTML namespace
HTML 命名空間中的 ul


The stack of open elements is said to have a particular element in button scope when it has that element in the specific scope consisting of the following element types:

當下列元素類型作為 list 時,符合在特定作用域中存在元素目標節點,該打開元素堆棧被認為在按鈕作用域中存在特定的元素

All the element types listed above for the has an element in scope algorithm.
算法 在作用域中有特定的元素 列出的所有元素。

button in the HTML namespace
HTML 命名空間中的 button


The stack of open elements is said to have a particular element in table scope when it has that element in the specific scope consisting of the following element types:

當下列元素類型作為 list 時,符合在特定作用域中存在元素目標節點,該打開元素堆棧被認為在表格作用域中存在特定的元素

html in the HTML namespace
HTML 命名空間中的 html

table in the HTML namespace
HTML 命名空間中的 table

template in the HTML namespace
HTML 命名空間中的 template


The stack of open elements is said to have a particular element in select scope when it has that element in the specific scope consisting of all element types except the following:

當除下列元素類型以外的所有元素類型作為 list 時,符合在特定作用域中存在元素目標節點,該打開元素堆棧被認為在選擇作用域中存在特定的元素

optgroup in the HTML namespace
HTML 命名空間中的 optgroup

option in the HTML namespace
HTML 命名空間中的 option


Nothing happens if at any time any of the elements in the stack of open elements are moved to a new location in, or removed from, the Document tree. In particular, the stack is not changed in this situation. This can cause, amongst other strange effects, content to be appended to nodes that are no longer in the DOM.

在任何時候,打開元素堆棧中的任何元素移動到一個新的位置或者從文檔樹中移除,都不會觸發任何操作。要注意的是,在這種情況下,堆棧沒有變動。這可能導致一些奇怪的效果,內容被附加在DOM中已不存在的節點。


Note: In some cases (namely, when closing misnested formatting elements), the stack is manipulated in a random-access fashion.
Note: 在某些情況下(即,關閉錯誤嵌套的格式化元素時),堆棧是以隨機存取的方式進行操作的。


12.2.4.3 現役格式化元素的列表 The list of active formatting elements

Initially, the list of active formatting elements is empty. It is used to handle mis-nested formatting element tags.

起初,現役格式化元素的列表為空。它是用於處理錯誤嵌套的格式化元素標籤。


The list contains elements in the formatting category, and markers. The markers are inserted when entering applet, object, marquee, template, td, th, and caption elements, and are used to prevent formatting from "leaking" into applet, object, marquee, template, td, th, and caption elements.

該列表包含格式化類別中的元素,以及標記。當進入 appletobjectmarqueetemplatetdthcaption 元素時附加該標記,這用於防止格式化「洩漏」到 appletobjectmarqueetemplatetdthcaption 元素。


In addition, each element in the list of active formatting elements is associated with the token for which it was created, so that further elements can be created for that token if necessary.

此外,現役格式化元素列表中的每個元素都與創建它的 token 關聯,所以當必要時可以為該 token 創建進一步的元素。


When the steps below require the UA to push onto the list of active formatting elements an element element, the UA must perform the following steps:

但下文的步驟要求用戶代理將元素 element 加入到現役格式化元素的列表中時,用戶代理必需執行以下步驟:

If there are already three elements in the list of active formatting elements after the last marker, if any, or anywhere in the list if there are no markers, that have the same tag name, namespace, and attributes as element, then remove the earliest such element from the list of active formatting elements. For these purposes, the attributes must be compared as they were when the elements were created by the parser; two elements have the same attributes if all their parsed attributes can be paired such that the two attributes in each pair have identical names, namespaces, and values (the order of the attributes does not matter).

如果在現役格式化元素列表中的最後一個標記后存在三個具有與 element 標籤名稱、命名空間、屬性都一樣的元素,那麼從現役格式化元素列表中移除第一個這樣的元素;如果不存在標記,那麼不限定三個相同元素在列表中的位置。為了達成這些目的,必需像解析器創建元素時那樣去比較屬性;如果兩個元素的所有屬性經過解析都能配對(屬性的-順序並不重要),使得每一對中的兩個屬性具有相同的名稱、命名空間和值,認為兩個元素具有相同的屬性。

Note: This is the Noah"s Ark clause. But with three per family instead of two.
Note: 這是諾亞方舟的條例。但是每家庭三個,而不是兩個。

Add element to the list of active formatting elements.

添加元素到現役格式化元素列表。


When the steps below require the UA to reconstruct the active formatting elements, the UA must perform the following steps:

當下文的步驟要求用戶代理重建現役格式化元素時,用戶代理必需執行以下步驟:

If there are no entries in the list of active formatting elements, then there is nothing to reconstruct; stop this algorithm.
如果現役格式化列表中沒有條目,那也沒有什麼可供重建的;終止這個算法。

If the last (most recently added) entry in the list of active formatting elements is a marker, or if it is an element that is in the stack of open elements, then there is nothing to reconstruct; stop this algorithm.
如果現役格式化元素列表中的最後一個(最近添加的)條目是一個標記,或者如果它是打開元素堆棧中的元素,那麼也沒有什麼可重建的,終止這個算法。

Let entry be the last (most recently added) element in the list of active formatting elements.
entry 為現役格式化元素列表中的最後一個(最近添加的)元素。

Rewind: If there are no entries before entry in the list of active formatting elements, then jump to the step labeled create.
Rewind: 如果在現役格式化元素列表中,沒有元素在 entry 之前,那麼跳轉到步驟標籤 create

Let entry be the entry one earlier than entry in the list of active formatting elements.
entry 為在現役格式化元素列表中,比 entry 的早一個加入的元素。

If entry is neither a marker nor an element that is also in the stack of open elements, go to the step labeled rewind.
如果 entry 既不是一個標記,也不是一個在打開元素堆棧中的元素,跳轉到步驟標籤 Rewind

Advance: Let entry be the element one later than entry in the list of active formatting elements.
Advance: 設 entry 為在現役格式化元素列表中,比 entry 後一個加入的元素。

Create: Insert an HTML element for the token for which the element entry was created, to obtain new element.
Create: 為創建 entry 的令牌插入一個 HTML 元素,得到 new element

Replace the entry for entry in the list with an entry for new element.
new element 的條目替換列表中 entry 的條目。

If the entry for new element in the list of active formatting elements is not the last entry in the list, return to the step labeled advance.
如果 new element 的條目在現役格式化元素列表中不是列表最後的條目,返回到步驟標籤 Advance


This has the effect of reopening all the formatting elements that were opened in the current body, cell, or caption (whichever is youngest) that haven"t been explicitly closed.

這將重新打開所以在當前主體、單元格和標題(最年輕的)中打開的所有元素,這些元素沒有被明確的關閉。


Note: The way this specification is written, the list of active formatting elements always consists of elements in chronological order with the least recently added element first and the most recently added element last (except for while steps 7 to 10 of the above algorithm are being executed, of course).
Note: 這個規範的編寫方式,現役格式化元素列表的元素永遠按時間順序排序,並且較前添加的元素在前,最近添加的元素在後(當然,執行上述算法的 7 至 10 步時是例外的)。


When the steps below require the UA to clear the list of active formatting elements up to the last marker, the UA must perform the following steps:

當下文的步驟要求用戶代理將現役格式化元素列表清除至最後一個標記處時,用戶代理必需執行以下步驟:

Let entry be the last (most recently added) entry in the list of active formatting elements.
entry 為現役格式化元素列表中最後(最近添加)的條目。

Remove entry from the list of active formatting elements.
從現役格式化元素列表中移除 entry

If entry was a marker, then stop the algorithm at this point. The list has been cleared up to the last marker.
如果 entry 是一個標記,在這裡停止算法。該列表已被清除至最後一個標記。

Go to step 1.
回到步驟 1。


12.2.4.4 元素的指針 The element pointers

Initially, the head element pointer and the form element pointer are both null.

最初,head 元素指針from 元素指針都是無效的。


Once a head element has been parsed (whether implicitly or explicitly) the head element pointer gets set to point to this node.

一旦一個 head 元素被解析(不論是隱式或是顯式),head 元素指針將被設置為指向這個節點。


The form element pointer points to the last form element that was opened and whose end tag has not yet been seen. It is used to make form controls associate with forms in the face of dramatically bad markup, for historical reasons. It is ignored inside template elements.

form 元素指針指向最後一個打開的並且未見到結束標籤的 form 元素。由於歷史原因,它被用作使表單控件與表單相關聯。它在 template 元素內部會被忽略。


12.2.4.5 其他解析狀態標記 Other parsing state flags

The scripting flag is set to "enabled" if scripting was enabled for the Document with which the parser is associated when the parser was created, and "disabled" otherwise.

如果在解析器創建時與解析器相關聯的 Document 中啟用腳本,那麼 scripting flag 被設置為 "enabled",否則被設置為 "disabled"。


Note: The scripting flag can be enabled even when the parser was originally created for the HTML fragment parsing algorithm, even though script elements don"t execute in that case.
Note: 即使在為 HTML 碎片解析算法創建解析器時,也可以將 scripting flag 設置為 enabled,哪怕在這種情況下 script 元素不執行。


The frameset-ok flag is set to "ok" when the parser is created. It is set to "not ok" after certain tokens are seen.

在創建解析器時,frameset-ok flag 被設置為 "ok"。當看到某些特定的令牌時,它被設為 "not ok"。


文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/51155.html

相关文章

  • 】chrome-remote-interface

    摘要:該支持下列事件當到的連接已建立時觸發。取得該調試協議描述符。在關閉請求收到響應后執行,他將獲得下列參數一個對象,指明成功狀態當缺省時,將返回一個對象。當缺省時,將返回一個對象,並且狀態取決于屬性。 本文翻譯自:chrome-remote-interface原文更新時間:July 21,2017譯者:Pandorym Chrome 調試協議 的接口,他提供一個使用 JavaScript ...

    lentoo 评论0 收藏0
  • 手把手深入理解 webpack dev middleware 原理與相關 plugins

    摘要:的架構設計促使第三方開發者讓核心發揮出無限的潛力。當然建置比起開發是較進階的議題,因為我們必須要理解內部的一些事件。這個編譯結果包含的訊息包含模組的狀態,編譯後的資源檔,發生異動的檔案,被觀察的相依套件等。 本文將對 webpack 周邊的 middleware 與 plugin 套件等作些介紹,若您對於 webpack 還不了解可以參考這篇彙整的翻譯。 webpack dev ser...

    gitmilk 评论0 收藏0
  • [ + 補充] Webpack 2 入門

    摘要:目錄許多開發者會把的目錄命名為但這並不強迫。所有的檔案都會使用從被編譯成。同時有個小小的重點那就是我們可已觀察編譯後的檔案大小。在專案目錄下執行可以觀察截至目前為止的結果。我們的目標是要把編譯封裝到我們的中。 在今時今日,webpack 已經成為前端開發非常重要的工具之一。本質上它是一個 Javascript 模組封裝工具,但透過 loaders 和 plugins 它也可以轉換封裝其...

    betacat 评论0 收藏0
  • [ + 更新] 參透 Node 中 exports 的 7 種設計模式

    摘要:現在,我們可以開始探討介面的設計模式了。匯出命名空間一個簡單且常用的設計模式就是匯出一個包含數個屬性的物件,這些屬性具體的內容主要是函式,但並不限於函式。如此,我們就能夠透過匯入該模組來取得這個命名空間下一系列相關的功能。 前言 這篇文章試著要整理,翻譯Export This: Interface Design Patterns for Node.js Modules這篇非常值得一讀的...

    wmui 评论0 收藏0
  • 深入 Javascript 執行環境

    摘要:中的執行環境與堆疊在這篇筆記中我將會深入的探討底層中的一些觀念,其中最重要的就是執行環境。其他執行環境都可以存取全域的東西。在這個階段直譯器會建立,透過掃描函式傳入的參數,內部的函式宣告,變數宣告。 Javascript 中的執行環境與堆疊 在這篇筆記中我將會深入的探討 JS 底層中的一些觀念,其中最重要的就是執行環境(Execution Context)。當您閱讀完這篇文章後您可能會...

    levius 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<