Browse Source

* Make creation of data-tags optional

michael 4 years ago
parent
commit
fe5ab42f2c
1 changed files with 5 additions and 3 deletions
  1. 5 3
      packages/webwidget/webwidget.pas

+ 5 - 3
packages/webwidget/webwidget.pas

@@ -447,6 +447,8 @@ Type
     Property HaveReferences : Boolean Read GetHaveReferences;
     // Property attrs
     Property StoredAttrs : TJSObject Read FAttrs;
+  Public
+    Class var CreateDataTags : Boolean;
   Public
     Constructor Create(aOwner : TComponent); override;
     Destructor Destroy; override;
@@ -475,7 +477,7 @@ Type
     Procedure Refresh;
     // Unrender
     Procedure Unrender; overload;
-    // Focus
+    // Focus widget. Will render if it was not yet rendered.
     Procedure Focus;
     // These work on the classes property, and on the current element if rendered. Returns the new value of classes.
     Function AddRemoveClasses(const aAddClasses, aRemoveClasses : String; Normalize : Boolean = false) : String;
@@ -2819,13 +2821,13 @@ Var
   Procedure MaybeSet(El : TJSHTMLElement; AName : String);
 
   begin
-    if Assigned(el) then
+    if Assigned(el) and CreateDataTags then
       el.Dataset[aName]:=AID;
   end;
 
 begin
   AID:=ElementID;
-  if assigned(Element) then
+  if assigned(Element) and Not CreateDataTags then
     Element.dataset[SElementClass]:=ClassName;
   MaybeSet(Element,SElementData);
   MaybeSet(TopElement,STopElementData);