MCPcopy
hub / github.com/ampproject/amphtml / updateExperimentRow

Function updateExperimentRow

tools/experiments/experiments.js:242–252  ·  view source on GitHub ↗

* Updates the state of a single experiment. * @param {!ExperimentDef} experiment

(experiment)

Source from the content-addressed store, hash-verified

240 * @param {!ExperimentDef} experiment
241 */
242function updateExperimentRow(experiment) {
243 const tr = document.getElementById('exp-tr-' + experiment.id);
244 if (!tr) {
245 return;
246 }
247 let state = isExperimentOn_(experiment.id) ? 1 : 0;
248 if (self.AMP_CONFIG[experiment.id]) {
249 state = 'default';
250 }
251 tr.setAttribute('data-on', state);
252}
253
254/**
255 * Returns whether the experiment is on or off.

Callers 1

updateFunction · 0.85

Calls 3

isExperimentOn_Function · 0.85
getElementByIdMethod · 0.45
setAttributeMethod · 0.45

Tested by

no test coverage detected