Skip to content

Commit b58aa6f

Browse files
committed
Using properties directly on the element instead of jQuery.data
See the last commit, 3b7a736, for more info.
1 parent 3b7a736 commit b58aa6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+224
-230
lines changed

src/Wt/Auth/AuthModel.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void AuthModel::updateThrottling(WInteractWidget *button)
8888
{
8989
if (passwordAuth() && passwordAuth()->attemptThrottlingEnabled()) {
9090
WStringStream s;
91-
s << "jQuery.data(" << button->jsRef() << ", 'throttle').reset("
91+
s << button->jsRef() << ".wtThrottle.reset("
9292
<< throttlingDelay_ << ");";
9393

9494
button->doJavaScript(s.str());

src/Wt/Chart/WAbstractGridData.C

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,27 +1808,27 @@ void WAbstractGridData::setChart(WCartesian3DChart *chart)
18081808
minPtChanged_ = true;
18091809
maxPtChanged_ = true;
18101810
changeClippingMinX_.setJavaScript("function(o,e,pos) {"
1811-
"var obj = $('#" + chart_->id() + "').data('obj');" +
1811+
"var obj = " + chart_->jsRef() + ".wtObj;" +
18121812
jsMinPt_.jsRef() + "[0] = pos;" +
18131813
chart->repaintSlot().execJs() + " }", 1);
18141814
changeClippingMaxX_.setJavaScript("function(o,e,pos) {"
1815-
"var obj = $('#" + chart_->id() + "').data('obj');" +
1815+
"var obj = " + chart_->jsRef() + ".wtObj;" +
18161816
jsMaxPt_.jsRef() + "[0] = pos;" +
18171817
chart->repaintSlot().execJs() + " }", 1);
18181818
changeClippingMinY_.setJavaScript("function(o,e,pos) {"
1819-
"var obj = $('#" + chart_->id() + "').data('obj');" +
1819+
"var obj = " + chart_->jsRef() + ".wtObj;" +
18201820
jsMinPt_.jsRef() + "[1] = pos;" +
18211821
chart->repaintSlot().execJs() + " }", 1);
18221822
changeClippingMaxY_.setJavaScript("function(o,e,pos) {"
1823-
"var obj = $('#" + chart_->id() + "').data('obj');" +
1823+
"var obj = " + chart_->jsRef() + ".wtObj;" +
18241824
jsMaxPt_.jsRef() + "[1] = pos;" +
18251825
chart->repaintSlot().execJs() + " }", 1);
18261826
changeClippingMinZ_.setJavaScript("function(o,e,pos) {"
1827-
"var obj = $('#" + chart_->id() + "').data('obj');" +
1827+
"var obj = " + chart_->jsRef() + ".wtObj;" +
18281828
jsMinPt_.jsRef() + "[2] = pos;" +
18291829
chart->repaintSlot().execJs() + " }", 1);
18301830
changeClippingMaxZ_.setJavaScript("function(o,e,pos) {"
1831-
"var obj = $('#" + chart_->id() + "').data('obj');" +
1831+
"var obj = " + chart_->jsRef() + ".wtObj;" +
18321832
jsMaxPt_.jsRef() + "[2] = pos;" +
18331833
chart->repaintSlot().execJs() + " }", 1);
18341834
}

src/Wt/Chart/WAxisSliderWidget.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void WAxisSliderWidget::paintEvent(WPaintDevice *paintDevice)
236236
series_->type() != SeriesType::Curve) {
237237
if (getMethod() == RenderMethod::HtmlCanvas) {
238238
WStringStream ss;
239-
ss << "jQuery.removeData(" << jsRef() << ",'sobj');";
239+
ss << "\ndelete " << jsRef() << ".wtSObj;";
240240
ss << "\nif (" << objJsRef() << ") {"
241241
<< objJsRef() << ".canvas.style.cursor = 'auto';"
242242
<< "setTimeout(" << objJsRef() << ".repaint,0);"
@@ -515,7 +515,7 @@ void WAxisSliderWidget::paintEvent(WPaintDevice *paintDevice)
515515

516516
std::string WAxisSliderWidget::sObjJsRef() const
517517
{
518-
return "jQuery.data(" + jsRef() + ",'sobj')";
518+
return jsRef() + ".wtSObj";
519519
}
520520

521521
WCartesianChart *WAxisSliderWidget::chart()

src/Wt/Chart/WCartesianChart.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4796,7 +4796,7 @@ WTransform WCartesianChart::curveTransform(const WDataSeries &series) const
47964796

47974797
std::string WCartesianChart::cObjJsRef() const
47984798
{
4799-
return "jQuery.data(" + jsRef() + ",'cobj')";
4799+
return jsRef() + ".wtCObj";
48004800
}
48014801

48024802
void WCartesianChart::addAxisSliderWidget(WAxisSliderWidget *slider)

src/Wt/WAbstractItemView.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ void WAbstractItemView::bindObjJS(JSlot& slot, const std::string& jsMethod)
12721272
{
12731273
slot.setJavaScript
12741274
("function(obj, event) {"
1275-
"""jQuery.data(" + jsRef() + ", 'obj')." + jsMethod + "(obj, event);"
1275+
"""" + jsRef() + ".wtObj." + jsMethod + "(obj, event);"
12761276
"}");
12771277
}
12781278

@@ -1281,7 +1281,7 @@ void WAbstractItemView::connectObjJS(EventSignalBase& s,
12811281
{
12821282
s.connect
12831283
("function(obj, event) {"
1284-
"""jQuery.data(" + jsRef() + ", 'obj')." + jsMethod + "(obj, event);"
1284+
"""" + jsRef() + ".wtObj." + jsMethod + "(obj, event);"
12851285
"}");
12861286
}
12871287

src/Wt/WAbstractMedia.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,13 @@ void WAbstractMedia::setFormData(const FormData& formData)
135135
void WAbstractMedia::play()
136136
{
137137
loadJavaScript();
138-
doJavaScript("jQuery.data(" + jsRef() + ", 'obj').play();");
138+
doJavaScript(jsRef() + ".wtObj.play();");
139139
}
140140

141141
void WAbstractMedia::pause()
142142
{
143143
loadJavaScript();
144-
doJavaScript("jQuery.data(" + jsRef() + ", 'obj').pause();");
144+
doJavaScript(jsRef() + ".wtObj.pause();");
145145
}
146146

147147
void WAbstractMedia::renderSource(DomElement* element,

src/Wt/WAbstractSpinBox.C

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public:
3838
return
3939
"new function() { "
4040
"""this.validate = function(t) {"
41-
"" "return jQuery.data(" + spinBox_->jsRef() + ", 'obj').validate(t);"
41+
"" "return " + spinBox_->jsRef() + ".wtObj.validate(t);"
4242
"""};"
4343
"}";
4444
}
@@ -115,7 +115,7 @@ void WAbstractSpinBox::render(WFlags<RenderFlag> flags)
115115

116116
if (jsValueChanged().needsUpdate(true)) {
117117
WStringStream function;
118-
function << "jQuery.data(" + jsRef() + ",'obj').jsValueChanged=";
118+
function << jsRef() << ".wtObj.jsValueChanged=";
119119
if (jsValueChanged().isConnected()) {
120120
function << "function(oldv, v){"
121121
#ifndef WT_TARGET_JAVA
@@ -137,7 +137,7 @@ void WAbstractSpinBox::connectJavaScript(Wt::EventSignalBase& s,
137137
{
138138
std::string jsFunction =
139139
"function(obj, event) {"
140-
"""var o = jQuery.data(" + jsRef() + ", 'obj');"
140+
"""var o = " + jsRef() + ".wtObj;"
141141
"""if (o) o." + methodName + "(obj, event);"
142142
"}";
143143

@@ -183,7 +183,7 @@ void WAbstractSpinBox::updateDom(DomElement& element, bool all)
183183
if (all || changed_) {
184184
if (!all) {
185185
if (!nativeControl())
186-
doJavaScript("jQuery.data(" + jsRef() + ", 'obj')"
186+
doJavaScript(jsRef() + ".wtObj"
187187
".configure("
188188
+ std::to_string(decimals()) + ","
189189
+ prefix().jsStringLiteral() + ","
@@ -242,7 +242,7 @@ ValidationState WAbstractSpinBox::validate()
242242
void WAbstractSpinBox::refresh()
243243
{
244244
doJavaScript
245-
("jQuery.data(" + jsRef() + ", 'obj')"
245+
(jsRef() + ".wtObj"
246246
".setLocale("
247247
+ jsStringLiteral(WLocale::currentLocale().decimalPoint()) + ","
248248
+ jsStringLiteral(WLocale::currentLocale().groupSeparator()) + ");");

src/Wt/WClientGLWidget.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@ std::string WClientGLWidget::glObjJsRef(const std::string& jsRef)
18621862
{
18631863
return "(function(){"
18641864
"var r = " + jsRef + ";"
1865-
"var o = r ? jQuery.data(r,'obj') : null;"
1865+
"var o = r ? r.wtObj : null;"
18661866
"return o ? o : {ctx: null};"
18671867
"})()";
18681868
}

src/Wt/WDateEdit.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void WDateEdit::connectJavaScript(Wt::EventSignalBase& s,
214214
{
215215
std::string jsFunction =
216216
"function(dobj, event) {"
217-
"""var o = jQuery.data(" + jsRef() + ", 'dobj');"
217+
"""var o = " + jsRef() + ".wtDObj;"
218218
"""if (o) o." + methodName + "(dobj, event);"
219219
"}";
220220

src/Wt/WDialog.C

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ void WDialog::setResizable(bool resizable)
354354
(" Resizable",
355355
"(new " WT_CLASS ".Resizable("
356356
WT_CLASS "," + jsRef() + ")).onresize(function(w, h, done) {"
357-
"var obj = $('#" + id() + "').data('obj');"
357+
"var obj = " + jsRef() + ".wtObj;"
358358
"if (obj) obj.onresize(w, h, done);"
359359
" });");
360360
}
@@ -696,7 +696,7 @@ void WDialog::bringToFront(const WMouseEvent &e)
696696

697697
void WDialog::raiseToFront()
698698
{
699-
doJSAfterLoad("jQuery.data(" + jsRef() + ", 'obj').bringToFront()");
699+
doJSAfterLoad(jsRef() + ".wtObj.bringToFront()");
700700
DialogCover *c = cover();
701701
c->bringToFront(this);
702702
}

0 commit comments

Comments
 (0)