* Make creation of data-tags optional

This commit is contained in:
michael 2020-11-27 08:41:43 +00:00
parent 1308f6be51
commit fe5ab42f2c

View File

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