Skip to content

Commit 2eabe34

Browse files
committed
pat-inject: Add comments while working.
1 parent 1e08ee5 commit 2eabe34

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/pat/inject/inject.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,22 +361,30 @@ const inject = {
361361
* Extract modifiers such as ::element or ::after.
362362
* Ensure that a target element exists.
363363
*/
364+
364365
if (cfg.url !== url) {
365366
// in case of multi-injection, all injections need to use
366367
// the same url
367368
log.error("Unsupported different urls for multi-inject");
368369
return false;
369370
}
371+
370372
// defaults
371373
cfg.source = cfg.source || cfg.defaultSelector;
372374
cfg.target = cfg.target || cfg.defaultSelector;
373375

376+
// Extract modifiers like ::element, ::before, ::after. These need to
377+
// be extracted before `ensureTarget` so that the CSS selectors are
378+
// fixed.
374379
if (!this.extractModifiers(cfg)) {
375380
return false;
376381
}
382+
383+
// Check, if the target can be found in the document to inject into.
377384
if (!this.ensureTarget(cfg)) {
378385
return false;
379386
}
387+
380388
this.listenForFormReset(cfg);
381389
return true;
382390
},

0 commit comments

Comments
 (0)