![]() ![]() I think it's a very trivial thing to do in jQuery, to replace one element in the set with another while keeping the integrity of the collection, wouldn't you say? of course I could turn the collection intro a real Array, iterate it, find the thing I want to replace and so on, but it would be nicer if it was more of an automatic thing. the page controller loads needed components and replaces the elements in the known set that needs to be replaced ( ) with real, data-binded, events-binded components. The page controller has no knowledge of the real browser's DOM, only the collection which is associated to the page, and for all it knows, it might or might not have been rendered, which isn't important at all. Using replaceWith () to replace a node will also remove any child nodes of the target. The simplicity afforded by the replaceWith () function is most noticeable in the ability to directly target the node that you want to change, replace, or modify. ![]() This whole thing is done in the page controller is not placing anything in the DOM itself, but rather pass a jQuery collection of the rendered template upwards to it's parent controller, and that one renders it. These are the top rated real world JavaScript examples of common/bootstrap-notify.success extracted from open source projects. replaceWith () is a jQuery function, making it valid JavaScript though it follows a different syntax. Some components are async and needs ajas to retrieve their data from the server, and once that is done, those components' DOM structure, from their own templates, will replace the components on the screen with the real ones. A javascript file, which is the controller, compile the page's template and then send the result to be rendered. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |