Skip to content

ko.validation.group no work on objects with observable _destroy #567

Description

@demitriusbelai

When create observableArray and its elements have observable _destroy, ko.validation.group don't validate these elements.

Test: http://jsbin.com/mijiqifudi/1/edit?html,js,output

Fix:

--- a/src/api.js                                                                                                                                                                   
+++ b/src/api.js                                                                                                                                                                   
@@ -65,7 +65,7 @@                                                                                                                                                                  

                //get list of values either from array or object but ignore non-objects                                                                                            
                // and destroyed objects                                                                                                                                           
-               if (val && !val._destroy) {                                                                                                                                        
+               if (val && !koUtils.unwrapObservable(val._destroy)) {                                                                                                              
                        if (utils.isArray(val)) {                                                                                                                                  
                                objValues = val;                                                                                                                                   
                        }      

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions