@@ -15,10 +15,10 @@ async function _update() {
1515}
1616
1717async function _updateSelectedNode ( selectedNode ) {
18- const ulEl = document . querySelector ( "#selected ul" ) ;
18+ const issueListEl = document . querySelector ( "#selected ul" ) ;
1919
2020 if ( ! _isValidElement ( selectedNode ) ) {
21- _render ( [ ] , ulEl ) ;
21+ _render ( [ ] , issueListEl ) ;
2222 return ;
2323 }
2424
@@ -34,20 +34,28 @@ async function _updateSelectedNode(selectedNode) {
3434 ..._webcompat . getCSSDeclarationBlockIssues ( declarations , _targetBrowsers ) ) ;
3535 }
3636
37- _render ( issues , ulEl ) ;
37+ _render ( issues , issueListEl ) ;
3838}
3939
4040async function _updateSubtree ( selectedNode ) {
41- const ulEl = document . querySelector ( "#subtree ul" ) ;
41+ const subtreeEl = document . getElementById ( "subtree" ) ;
42+ const issueListEl = subtreeEl . querySelector ( "ul" ) ;
4243
4344 if ( ! _isValidElement ( selectedNode ) ) {
44- _render ( [ ] , ulEl ) ;
45+ _render ( [ ] , issueListEl ) ;
4546 return ;
4647 }
4748
4849 const issues = [ ] ;
4950
50- for ( const node of await browser . experiments . inspectedNode . getNodesInSubtree ( ) ) {
51+ subtreeEl . classList . add ( "processing" ) ;
52+ const progressEl = subtreeEl . querySelector ( "aside label" ) ;
53+
54+ progressEl . textContent = "Getting all descendants of the selected node" ;
55+ const nodesInSubtree = await browser . experiments . inspectedNode . getNodesInSubtree ( ) ;
56+
57+ progressEl . textContent = "Getting web compatibility issues for HTML element" ;
58+ for ( const node of nodesInSubtree ) {
5159 if ( ! _isValidElement ( node ) ) {
5260 continue
5361 }
@@ -57,43 +65,49 @@ async function _updateSubtree(selectedNode) {
5765 ..._webcompat . getHTMLElementIssues ( nodeName , attributes , _targetBrowsers ) ) ;
5866 }
5967
68+ progressEl . textContent = "Getting all descendants of the selected node" ;
6069 const declarationBlocks = await browser . experiments . inspectedNode . getStylesInSubtree ( ) ;
70+
71+ progressEl . textContent = "Getting web compatibility issues for CSS styles" ;
6172 for ( const { declarations } of declarationBlocks ) {
6273 issues . push (
6374 ..._webcompat . getCSSDeclarationBlockIssues ( declarations , _targetBrowsers ) ) ;
6475 }
6576
66- _render ( issues , ulEl ) ;
77+ progressEl . textContent = "Rendering all issues" ;
78+ _render ( issues , issueListEl ) ;
79+
80+ subtreeEl . classList . remove ( "processing" ) ;
6781}
6882
6983function _isValidElement ( { nodeType, isCustomElement } ) {
7084 return nodeType === Node . ELEMENT_NODE && ! isCustomElement ;
7185}
7286
73- function _render ( issues , ulEl ) {
74- ulEl . innerHTML = "" ;
87+ function _render ( issues , issueListEl ) {
88+ issueListEl . innerHTML = "" ;
7589
7690 if ( ! issues . length ) {
77- const liEl = document . createElement ( "li" ) ;
78- liEl . textContent = "No issues" ;
79- ulEl . appendChild ( liEl ) ;
91+ const noIssueEl = document . createElement ( "li" ) ;
92+ noIssueEl . textContent = "No issues" ;
93+ issueListEl . appendChild ( noIssueEl ) ;
8094 } else {
8195 for ( const issue of issues ) {
82- ulEl . appendChild ( _renderIssue ( issue ) ) ;
96+ issueListEl . appendChild ( _renderIssue ( issue ) ) ;
8397 }
8498 }
8599}
86100
87101function _renderIssue ( issue ) {
88- const liEl = document . createElement ( "li" ) ;
102+ const issueEl = document . createElement ( "li" ) ;
89103 const subjectEl = _renderSubject ( issue ) ;
90104 const predicateEl = _renderPredicate ( issue ) ;
91- liEl . appendChild ( subjectEl ) ;
92- liEl . appendChild ( predicateEl ) ;
105+ issueEl . appendChild ( subjectEl ) ;
106+ issueEl . appendChild ( predicateEl ) ;
93107
94- liEl . classList . add ( ( issue . deprecated ? "warning" : "information" ) ) ;
108+ issueEl . classList . add ( ( issue . deprecated ? "warning" : "information" ) ) ;
95109
96- return liEl ;
110+ return issueEl ;
97111}
98112
99113function _renderSubject ( issue ) {
0 commit comments