This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I have following HTML <!DOCTYPE html> <html> <head> <title>TODO supply a title</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="styles/style.css" rel="stylesheet" type="text/css"/> </head> <body> <h2>Your message:</h2> <textarea rows="5" cols="40" data-bind="textInput: currentMessage"> </textarea><br/> <button type="button" data-bind="click: sendText">Send</button> <h2>Messages:</h2> <messages params="messages: messages"></messages> <script src="libs/knockout/knockout-min.js" type="text/javascript"></script> <script src="src.js" type="text/javascript"></script> </body> </html> and following JS: ko.components.register('messages', { viewModel: function (params) { this.messages = ko.observable(params.messages || []); }, template: '<table><tbody data-bind="foreach: messages"><tr><td> <span data-bind="text: msg"></span>:<span data-bind="text: value"></span></td></tr></tbody></table>' }); Please notice the wrong indentation of <messages> element in the HTML code, it should be on same level as the <h2> above. Thanks Product Version: NetBeans IDE Dev (Build web-main-1474-on-20141031) Java: 1.8.0_20; Java HotSpot(TM) Client VM 25.20-b23 Runtime: Java(TM) SE Runtime Environment 1.8.0_20-b26 System: Linux version 3.13.0-35-generic running on i386; UTF-8; en_US (nb)
This happens only in case if custom element is placed directly inside the body element. If it's placed in e.g., div, then formatting is correct. Same issue applies to the user-defined HTML custom elements: e.g., write <test-element></test-element> inside the body and click offered hint, select "Add element "test-element" to the projects custom elements", then reformat the document. It seems to be more general issue with indentation. Reassigning to HTML editor for evaluation. Thanks.
I have the same problem if the element is inside of a <td>
I checked code and it is because of this function org/netbeans/modules/web/indent/api/support/MarkupAbstractIndenter:calculateAllVirtualCloseTagsForOpenTag():697 Netbeans finds unknown tag (messages), virtually close <body> tag and thinks, this is after </body> I don't know if this functionality is useful. It can be removed, and then it will work well in this case.