Problems about local refresh of avalon scan in avalon.js

1. I would like to ask how to write avalon.scan, can you scan only one node instead of the whole document?? In practical applications, there are some html fragments that are temporarily obtained through pjax and only want to scan this part of the node rather than the whole body.
2. In the example on the official website, it says:

avalon.ready(function(){
    avalon.define({
       $id: "test",
       aaa: 111
    })
    vm.$watch("onReady", function(){
        //ms-controller, ms-important
        //ms-*
    })
     //2.1.15
    vm.$watch("onDispose", function(){
        delete avalon.vmodels[vm.$id]
        if(avalon.scopes){
           delete avalon.scopes[vm.$id]
        }
    })
    avalon.scan(document.body)
})

3, according to the code, after many tests, this writing seems to be effective, and the writing methods in the examples do not seem to work:

// :
avalon.scan(document.body, model, avalon.noop());
// model
var model = avalon.define({
    $id: "vm",
    data: {},
    ...
});

4. Scan for the whole body is very resource-consuming, and it will also affect the style of other tab pages. Solve.

Apr.02,2021

after searching, it is confirmed that the following problem has been satisfactorily solved:
the wrapped DOM object in jQuery is actually an array. There are two ways to get pure DOM object:

< H2 > 1. Access using array index, for example: < / H2 >
var dom = $(dom)[0];

such as:

$("-sharpid")[0]
< H2 > 2. Use the function get () to access, for example: < / H2 >
var dom = $(dom).get(0);
The argument in the

get () function is an index number.

< H2 > 3. If it is changed to write as follows, there is no problem with local refresh: < / H2 >
// jquery  
var $form = $('form[test_form]');
// DOM 
var _dom_test_form = $form.get(0);
// avalon scan
avalon.scan(_dom_test_form, model, avalon.noop());
$form.form({
    // do sth ...
});

Test succeeded!

Menu