If canning, prepare a water bath canner, half-pint jars and lids before beginning, and heat the canner water to about 180 degrees F. If not canning, let the jam cool on the counter in jars before storing it in the refrigerator.
Heat oil in a heavy-bottomed pan or Dutch oven over medium-high heat, then add the sliced onions and stir to coat.
Reduce the heat to medium and cook the onions, stirring often, until they're soft, starting to turn golden, and cooked down to about half their original volume, about 45 to 50 minutes. Don't rush them with higher heat, which chars them.
Add maple sugar to the cooked onions and stir to dissolve the sugar.
Increase the heat to medium-high and cook the onions and sugar for 3 to 4 minutes, stirring constantly.
Carefully stir in the vinegar and lemon juice, being cautious of splattering and vinegar vapor.
Reduce the heat to medium and add salt to the mixture.
Cook the onion mixture until the vinegar has reduced to a sticky syrup, about 10 to 12 minutes.
Pour or ladle the hot jam into hot half-pint jars, leaving 1/2 inch headspace at the top of the jars.
Wipe the rims of the jars with a clean cloth, and apply the 2-part canning lids.
Set the jars in the canner, bring the water to a full rolling boil, and process for 10 minutes, adjusting for altitude (see notes).
Turn off the heat, take the lid off the canner, and let the jars sit in the water for 5 minutes before lifting them out. Let them cool for 12 to 24 hours, then check the seals and refrigerate any jar that didn't seal.
Sealed onion jam keeps its best quality for up to 18 months in a cool, dark place. Refrigerate it once opened.